mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-24 14:55:02 +03:00
f172bc3f10
* fix(node-sync): do not latch node disable when master allows (#6870) nodeDisableIsStale trusted any node-reported enable=false whose limits matched the master's, treating it as a genuine verdict and latching it on the master. But matching limits no longer prove the verdict: a single stray false (a depleted snapshot the master later re-enabled, a stale disableInvalidClients hit, or a push that lagged a quota reset) leaves the client stuck disabled on the node, and every master tick flips the client's state again. This is the loop reported in #6870. Make nodeDisableIsStale a single rule: stale iff the master's own deadline and quota still permit the client. A genuine combined-quota or expiry disable (masterLimitsAllowClient == false) still latches, preserving #4917. Mirror the same rule in ClientTrafficEnableMergeExpr so the SQL UPDATE and the Go in-memory replay cannot drift. * fix(node-sync): keep node usage over quota latching a node disable Dropping the matching-limits latch (#6870) let the master re-enable a client the node had genuinely counted past its quota whenever the master's own counters lagged, e.g. after a seeded-at-zero adoption, reopening #4917. A node's enable=false now stays latched when the node's own usage already spends the master's quota; otherwise the master's limits decide, so a stray disable no longer loops. Restores TestNodeQuotaDisable_SameExpiryStillLatches as it was on main. --------- Co-authored-by: Alireza Ahmadi <alireza7@gmail.com>