Files
mirror-3x-ui/internal/web/service
Sanaei c7c7584ab1 fix(inbounds): stop sending one UPDATE per client on an inbound save
The inbound form cannot change clients, yet a save issued one
client_traffics UPDATE for every client it kept. efb6c6d5 made those
statements write nothing when the row already matched, but each one was
still a round trip: 100,514 statements to save a 100,000-client inbound.
On a remote PostgreSQL that is about a minute, past the 30 s the HTTP
server allows a response, so the save looked failed after it committed.

Read the kept clients' lifecycle columns in chunks, compare them in Go
and send the guarded UPDATE only for the rows that differ, a NULL
column included. The same save is now 764 statements. Against a running
panel on PostgreSQL 16 with Xray 26.11.9 it went from 23.0 s to 5.9 s;
what remains is decoding and rewriting the 29 MB settings value.

Closes #7207
2026-11-25 22:01:02 +03:30
..