1

Try to gracefully stop all existing goroutines

This commit is contained in:
Vladimir Hodakov 2019-01-09 16:06:47 +04:00
parent f240def745
commit 86ddbb26f8
Signed by: Vladimir Hodakov
GPG Key ID: 673980B6882F82C6
2 changed files with 47 additions and 46 deletions

View File

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

View File

@ -73,6 +73,9 @@ func Authenticate() {
func Connect() {
go func() {
announcesv1.ZookeeperReceiver(client)
<-c.ShutdownDone
return
}()
rawUpdates := client.GetRawUpdatesChannel(100)
log.Debug().Msg("Connection with Telegram established")