Don't wait 3 seconds if the context was cancelled
Nicolás Pazos npazosmendez@gmail.com
Mon, 19 Aug 2024 23:32:16 -0300
1 files changed,
5 insertions(+),
4 deletions(-)
jump to
M
bot.go
→
bot.go
@@ -473,10 +473,11 @@ }
updates, err := bot.GetUpdatesWithContext(ctx, config) if err != nil { - log.Println(err) - log.Println("Failed to get updates, retrying in 3 seconds...") - time.Sleep(time.Second * 3) - + if ctx.Err() == nil { + log.Println(err) + log.Println("Failed to get updates, retrying in 3 seconds...") + time.Sleep(time.Second * 3) + } continue }