1

Try to terminal all goroutines at shutdown gracefully

This commit is contained in:
2019-01-09 15:48:34 +04:00
parent dca290beb1
commit f240def745

View File

@@ -24,6 +24,7 @@ func ZookeeperReceiver(client *tdlib.Client) {
receiver := client.AddEventReceiver(&tdlib.UpdateNewMessage{}, fwMessagesFilter, 5) receiver := client.AddEventReceiver(&tdlib.UpdateNewMessage{}, fwMessagesFilter, 5)
log.Debug().Msg("Receiver added") log.Debug().Msg("Receiver added")
go func() {
for newMsg := range receiver.Chan { for newMsg := range receiver.Chan {
updateMsg := (newMsg).(*tdlib.UpdateNewMessage) updateMsg := (newMsg).(*tdlib.UpdateNewMessage)
// Check if message text contains needed battle data // Check if message text contains needed battle data
@@ -74,4 +75,5 @@ func ZookeeperReceiver(client *tdlib.Client) {
<-c.ShutdownDone <-c.ShutdownDone
return return
} }
}()
} }