mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #3583] [MERGED] Fix: Complete graceful Telegram bot shutdown and concurrency hardening #5457
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5457
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/3583
Author: @OleksandrParshyn
Created: 11/1/2025
Status: ✅ Merged
Merged: 11/1/2025
Merged by: @MHSanaei
Base:
main← Head:main📝 Commits (2)
a9db70fFix: Invoke service.StopBot() in signal handlerse1fd563Merge pull request #1 from OleksandrParshyn/OleksandrParshyn-patch-2📊 Changes
1 file changed (+8 additions, -0 deletions)
View changed files
📝
main.go(+8 -0)📄 Description
Description
This comprehensive fix addresses the Telegram bot conflict (409) during panel restarts and ensures robust thread safety in bot operation.
Changes
service.StopBot()inmain.gofor bothSIGHUP(restart) and service shutdown, ensuring the bot's Long Polling stops before the process is terminated/restarted.botWG sync.WaitGroupto replace unreliabletime.Sleep(), guaranteeing explicit waiting for the Long Polling goroutine to exit cleanly.tgBotMutex sync.Mutexand logic to protect concurrent access to the globalbotCancelvariable intgbot.go.Tgbot.OnReceive()to correctly use context cancellation and managebotWGwithin the Long Polling goroutine.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.