
After the new changes return from the waitUpdates function was lost when the passed context was terminated.
21 lines
305 B
Go
21 lines
305 B
Go
package bot
|
|
|
|
import (
|
|
"context"
|
|
"sync"
|
|
)
|
|
|
|
// waitUpdates listen Updates channel and run ProcessUpdate
|
|
func (b *Bot) waitUpdates(ctx context.Context, wg *sync.WaitGroup) {
|
|
defer wg.Done()
|
|
|
|
for {
|
|
select {
|
|
case <-ctx.Done():
|
|
return
|
|
case upd := <-b.updates:
|
|
b.ProcessUpdate(ctx, upd)
|
|
}
|
|
}
|
|
}
|