2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-10-24 10:36:12 +08:00
Allow a server instance to be gracefully shutdown programmatically
This commit is contained in:
herb
2022-04-22 13:38:46 -07:00
parent 5c723f597e
commit d1e5e4f2f1
4 changed files with 34 additions and 11 deletions

View File

@@ -10,6 +10,7 @@ import (
"fmt"
"math"
"math/rand"
"os"
"runtime"
"strings"
"sync"
@@ -51,6 +52,7 @@ type Server struct {
healthchecker *healthchecker
janitor *janitor
aggregator *aggregator
sigs chan os.Signal
}
type serverState struct {
@@ -547,6 +549,7 @@ func NewServer(r RedisConnOpt, cfg Config) *Server {
healthchecker: healthchecker,
janitor: janitor,
aggregator: aggregator,
sigs: make(chan os.Signal, 1),
}
}