mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-20 10:00:58 +00:00
fix(xray): retry a failed pending-restart instead of dropping the config change
The 30s cron consumed the need-restart flag with IsNeedRestartAndSetFalse before calling RestartXray and only logged a failure. If RestartXray failed early (a transient GetXrayConfig DB error) the old process kept running the old config, the crash detector saw a running process and never retried, and the flag stayed cleared — so an admin's saved change silently never reached the core. Move the consume/restart/retry into ApplyPendingRestart, which re-arms the flag on failure so the next tick retries.
This commit is contained in:
+1
-6
@@ -314,12 +314,7 @@ func (s *Server) startTask(restartXray bool) {
|
||||
|
||||
// Check if xray needs to be restarted every 30 seconds
|
||||
_, _ = s.cron.AddFunc(cadenceXrayRestart, func() {
|
||||
if s.xrayService.IsNeedRestartAndSetFalse() {
|
||||
err := s.xrayService.RestartXray(false)
|
||||
if err != nil {
|
||||
logger.Error("restart xray failed:", err)
|
||||
}
|
||||
}
|
||||
s.xrayService.ApplyPendingRestart()
|
||||
})
|
||||
|
||||
go func() {
|
||||
|
||||
Reference in New Issue
Block a user