Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/activator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"os/signal"
"strconv"
"strings"
"syscall"
"time"

"github.com/cortexlabs/cortex/pkg/activator"
Expand Down Expand Up @@ -167,14 +168,13 @@ func main() {
}

sigint := make(chan os.Signal, 1)
signal.Notify(sigint, os.Interrupt)
signal.Notify(sigint, os.Interrupt, syscall.SIGTERM)

select {
case err = <-errCh:
exit(log, err, "failed to start activator server")
case <-sigint:
// We received an interrupt signal, shut down.
log.Info("Received TERM signal, handling a graceful shutdown...")
log.Info("Received INT or TERM signal, handling a graceful shutdown...")

for name, server := range servers {
log.Infof("Shutting down %s server", name)
Expand Down
6 changes: 3 additions & 3 deletions cmd/autoscaler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"os/signal"
"strconv"
"strings"
"syscall"
"time"

"github.com/cortexlabs/cortex/pkg/autoscaler"
Expand Down Expand Up @@ -225,14 +226,13 @@ func main() {
}()

sigint := make(chan os.Signal, 1)
signal.Notify(sigint, os.Interrupt)
signal.Notify(sigint, os.Interrupt, syscall.SIGTERM)

select {
case err = <-errCh:
exit(log, err, "failed to start autoscaler server")
case <-sigint:
// We received an interrupt signal, shut down.
log.Info("Received TERM signal, handling a graceful shutdown...")
log.Info("Received INT or TERM signal, handling a graceful shutdown...")
log.Info("Shutting down server")
if err = server.Shutdown(context.Background()); err != nil {
// Error from closing listeners, or context timeout:
Expand Down
5 changes: 3 additions & 2 deletions cmd/dequeuer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"os"
"os/signal"
"strconv"
"syscall"

"github.com/DataDog/datadog-go/statsd"
"github.com/cortexlabs/cortex/pkg/consts"
Expand Down Expand Up @@ -210,7 +211,7 @@ func main() {
}()

sigint := make(chan os.Signal, 1)
signal.Notify(sigint, os.Interrupt)
signal.Notify(sigint, os.Interrupt, syscall.SIGTERM)

sqsDequeuer, err := dequeuer.NewSQSDequeuer(dequeuerConfig, awsClient, log)
if err != nil {
Expand Down Expand Up @@ -239,7 +240,7 @@ func main() {
case err = <-errCh:
exit(log, err, "error during message dequeueing or error from admin server")
case <-sigint:
log.Info("Received TERM signal, handling a graceful shutdown...")
log.Info("Received INT or TERM signal, handling a graceful shutdown...")
sqsDequeuer.Shutdown()
log.Info("Shutdown complete, exiting...")
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"os"
"os/signal"
"strconv"
"syscall"
"time"

"github.com/cortexlabs/cortex/pkg/lib/aws"
Expand Down Expand Up @@ -167,14 +168,13 @@ func main() {
}

sigint := make(chan os.Signal, 1)
signal.Notify(sigint, os.Interrupt)
signal.Notify(sigint, os.Interrupt, syscall.SIGTERM)

select {
case err = <-errCh:
exit(log, errors.Wrap(err, "failed to start proxy server"))
case <-sigint:
// We received an interrupt signal, shut down.
log.Info("Received TERM signal, handling a graceful shutdown...")
log.Info("Received INT or TERM signal, handling a graceful shutdown...")

for name, server := range servers {
log.Infof("Shutting down %s server", name)
Expand Down