Fix a rare crash when restarting a system task after shutdown was called
This commit is contained in:
parent
1844832255
commit
1c1140f4f3
10
satan.go
10
satan.go
|
@ -143,6 +143,16 @@ func (s *Satan) processTask(t *task) {
|
|||
}
|
||||
|
||||
func (s *Satan) processSystemTask(t *task) {
|
||||
// Abort starting a system task if shutdown was already called. Otherwise
|
||||
// incrementing a wait group counter will cause a panic. This should be an
|
||||
// extremely rare scenario when a system task crashes and tries to restart
|
||||
// after a shutdown call.
|
||||
select {
|
||||
case <-s.shutdownSystem:
|
||||
return
|
||||
default:
|
||||
}
|
||||
|
||||
s.wgSystem.Add(1)
|
||||
defer s.wgSystem.Done()
|
||||
defer func() {
|
||||
|
|
Loading…
Reference in New Issue