Skip to content

Commit

Permalink
Fix Updater.Stop() panic (PaulSonOfLars#69)
Browse files Browse the repository at this point in the history
Updater.Stop() causes a call to http.Server.Shutdown() that make the listeners to immediately return ErrServerClosed, causing a panic when shutting down normally. On the contrary, we don't want to panic on ErrServerClosed.
  • Loading branch information
vassilit authored Dec 31, 2022
1 parent 529ab6d commit db2eacb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func (u *Updater) StartWebhook(b *gotgbot.Bot, opts WebhookOpts) error {
} else {
err = u.server.ListenAndServe()
}
if err != nil && errors.Is(err, http.ErrServerClosed) {
if err != nil && !errors.Is(err, http.ErrServerClosed) {
panic("http server failed: " + err.Error())
}
}()
Expand Down

0 comments on commit db2eacb

Please sign in to comment.