mirror of
https://github.com/hibiken/asynq.git
synced 2025-07-01 02:43:40 +08:00
fix: add queue after server stopped
This commit is contained in:
parent
8d2955efc1
commit
a05cbd2e38
@ -810,15 +810,14 @@ func (srv *Server) AddQueue(qname string, priority, concurrency int) {
|
||||
return
|
||||
}
|
||||
|
||||
srv.queues[qname] = priority
|
||||
|
||||
srv.state.mu.Lock()
|
||||
state := srv.state.value
|
||||
srv.state.mu.Unlock()
|
||||
if state == srvStateNew || state == srvStateClosed {
|
||||
srv.queues[qname] = priority
|
||||
srv.state.mu.Unlock()
|
||||
return
|
||||
}
|
||||
srv.state.mu.Unlock()
|
||||
|
||||
srv.logger.Info("restart server...")
|
||||
srv.forwarder.shutdown()
|
||||
@ -832,6 +831,8 @@ func (srv *Server) AddQueue(qname string, priority, concurrency int) {
|
||||
srv.heartbeater.shutdown()
|
||||
srv.wg.Wait()
|
||||
|
||||
srv.queues[qname] = priority
|
||||
|
||||
qnames := make([]string, 0, len(srv.queues))
|
||||
for q := range srv.queues {
|
||||
qnames = append(qnames, q)
|
||||
|
Loading…
x
Reference in New Issue
Block a user