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

@@ -41,6 +41,7 @@ type Scheduler struct {
// to avoid using cron.EntryID as the public API of
// the Scheduler.
idmap map[string]cron.EntryID
sigs chan os.Signal
}
// NewScheduler returns a new Scheduler instance given the redis connection option.
@@ -77,6 +78,7 @@ func NewScheduler(r RedisConnOpt, opts *SchedulerOpts) *Scheduler {
done: make(chan struct{}),
errHandler: opts.EnqueueErrorHandler,
idmap: make(map[string]cron.EntryID),
sigs: make(chan os.Signal, 1),
}
}