fix(node): reconcile the local core after node disables without forcing it

The node traffic sync restarted the master's own Xray with force after
any tick that disabled clients, so a node reporting a fresh over-quota
client every few seconds dropped every local user's connections each
time, though nodes serve none of them. Use the non-forced restart the
local traffic job uses: an unchanged local config keeps the core, and a
change still restarts when restartXrayOnClientDisable asks for it.
Reaching RestartXray needs a running core, so no unit test covers this.
This commit is contained in:
MHSanaei
2026-10-31 10:44:59 +01:00
parent f67111a08a
commit 469758837a
+3 -1
View File
@@ -140,7 +140,9 @@ func (j *NodeTrafficSyncJob) Run() {
}
if clientsDisabled {
if restartOnDisable, settingErr := j.settingService.GetRestartXrayOnClientDisable(); settingErr == nil && restartOnDisable {
if err := j.xrayService.RestartXray(true); err != nil {
// Not forced: a client only nodes serve leaves the local config unchanged, and a node
// deciding when this tick disables clients must not decide when local users drop.
if err := j.xrayService.RestartXray(false); err != nil {
logger.Warning("node traffic sync: restart xray after disabling clients failed:", err)
j.xrayService.SetToNeedRestart()
}