3x-ui/web/service
OleksandrParshyn 4c929a8bcc
Refactor: Replace time.Sleep with sync.WaitGroup for reliable TgBot shutdown
Replaced the unreliable `time.Sleep(1 * time.Second)` in `service.StopBot()` with `sync.WaitGroup`. This ensures the Long Polling goroutine is explicitly waited for and reliably exits before the panel continues, preventing potential resource leaks and incomplete shutdowns during restarts.

Changes:
- Added `botWG sync.WaitGroup` variable.
- Updated `service.StopBot()` to call `botWG.Wait()` instead of `time.Sleep()`.
- Modified `Tgbot.OnReceive()` to correctly use `botWG.Add(1)` and `defer botWG.Done()` within the Long Polling goroutine.
- Corrected the goroutine structure in `OnReceive()` to properly encapsulate all message handling logic.
2025-10-31 15:35:13 +01:00
..
config.json dokodemo-door, socks renamed to mixed, tunnel 2025-09-09 13:57:40 +02:00
inbound.go gofmt 2025-10-21 13:02:55 +02:00
outbound.go docs: add comments for all functions 2025-09-20 09:35:50 +02:00
panel.go docs: add comments for all functions 2025-09-20 09:35:50 +02:00
server.go fix(import): prevent sqlite disk I/O error by validating temp DB then swapping 2025-10-14 22:03:17 +02:00
setting.go gofmt 2025-10-21 13:02:55 +02:00
tgbot.go Refactor: Replace time.Sleep with sync.WaitGroup for reliable TgBot shutdown 2025-10-31 15:35:13 +01:00
user.go gofmt 2025-10-21 13:02:55 +02:00
warp.go docs: add comments for all functions 2025-09-20 09:35:50 +02:00
xray.go docs: add comments for all functions 2025-09-20 09:35:50 +02:00
xray_setting.go docs: add comments for all functions 2025-09-20 09:35:50 +02:00