Try to gracefully stop all existing goroutines
This commit is contained in:
parent
f240def745
commit
86ddbb26f8
@ -24,7 +24,6 @@ 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
|
||||||
@ -75,5 +74,4 @@ func ZookeeperReceiver(client *tdlib.Client) {
|
|||||||
<-c.ShutdownDone
|
<-c.ShutdownDone
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,9 @@ func Authenticate() {
|
|||||||
func Connect() {
|
func Connect() {
|
||||||
go func() {
|
go func() {
|
||||||
announcesv1.ZookeeperReceiver(client)
|
announcesv1.ZookeeperReceiver(client)
|
||||||
|
|
||||||
|
<-c.ShutdownDone
|
||||||
|
return
|
||||||
}()
|
}()
|
||||||
rawUpdates := client.GetRawUpdatesChannel(100)
|
rawUpdates := client.GetRawUpdatesChannel(100)
|
||||||
log.Debug().Msg("Connection with Telegram established")
|
log.Debug().Msg("Connection with Telegram established")
|
||||||
|
Reference in New Issue
Block a user