mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-06 21:25:04 +03:00
510bee2f30
submitTrafficWrite falls back to running fn inline when the serial writer is not running (before StartTrafficWriter, during the shutdown drain, in CLI paths and tests). That path took no lock, so an inline write could run beside the draining writer or another inline write, breaking the single-writer invariant that guards the Postgres deadlock. One visible effect: ResetTrafficByEmail fans out one reset per inbound. Run side by side, the second reset read the record still disabled but the traffic already zeroed, judged the client operator-disabled and saved enable=false over the first reset's restore (TestResetTrafficByEmail_ReenablesEveryInboundOfTheClient failed ~25%). safeApply now holds a package mutex, so every write path is serialized.