Merge pull request #1 from OleksandrParshyn/OleksandrParshyn-patch-2

Fix: Invoke service.StopBot() in signal handlers
This commit is contained in:
OleksandrParshyn 2025-10-31 13:43:41 +01:00 committed by GitHub
commit e1fd5635bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -78,6 +78,10 @@ func runWebServer() {
case syscall.SIGHUP: case syscall.SIGHUP:
logger.Info("Received SIGHUP signal. Restarting servers...") logger.Info("Received SIGHUP signal. Restarting servers...")
// --- FIX FOR TELEGRAM BOT CONFLICT (409): Stop bot before restart ---
service.StopBot()
// --
err := server.Stop() err := server.Stop()
if err != nil { if err != nil {
logger.Debug("Error stopping web server:", err) logger.Debug("Error stopping web server:", err)
@ -106,6 +110,10 @@ func runWebServer() {
log.Println("Sub server restarted successfully.") log.Println("Sub server restarted successfully.")
default: default:
// --- FIX FOR TELEGRAM BOT CONFLICT (409) on full shutdown ---
service.StopBot()
// ------------------------------------------------------------
server.Stop() server.Stop()
subServer.Stop() subServer.Stop()
log.Println("Shutting down servers.") log.Println("Shutting down servers.")