telebot
telebot copied to clipboard
Panic on bot.Stop() v4.0.0-beta.4
panic: close of closed channel
goroutine 44 [running]:
gopkg.in/telebot%2ev4.(*Webhook).waitForStop(...)
gopkg.in/[email protected]/webhook.go:161
gopkg.in/telebot%2ev4.(*Webhook).Poll.func1(0xc000450a10)
gopkg.in/[email protected]/webhook.go:148 +0x2f
created by gopkg.in/telebot%2ev4.(*Webhook).Poll in goroutine 40
gopkg.in/[email protected]/webhook.go:147 +0x18a
the code
go bot.Start() // 1. Start the bot
<-ctx.Done() // 2. Wait for context cancel on SIGING or SIGTERM
bot.Stop() // 3. Stop the bot
// ^^^^ Panic goes here!
The same error with v3.3.8
panic: close of closed channel
goroutine 80 [running]:
gopkg.in/telebot%2ev3.(*Webhook).waitForStop(...)
/go/pkg/mod/gopkg.in/[email protected]/webhook.go:155
gopkg.in/telebot%2ev3.(*Webhook).Poll.func1(0xc00007ff80)
/go/pkg/mod/gopkg.in/[email protected]/webhook.go:142 +0x2f
created by gopkg.in/telebot%2ev3.(*Webhook).Poll in goroutine 59
/go/pkg/mod/gopkg.in/[email protected]/webhook.go:141 +0x187
- Use webhook & webhook.ServeHTTP(c.Writer, c.Request) in Gin (http)
- bot.Start()
- sleep(1s)
- bot.Stop() -> panic!!