mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-26 15:55:02 +03:00
perf(ip-sync): avoid redundant client IP reads and writes (#6930)
The access-log scanner and the cross-node merge stored the same IP list in opposite orders, so neither saw a row as unchanged, and the merge re-read every preloaded row and re-upserted every attribution row each sync cycle. All writers now share one canonical encoder (timestamp, then IP ascending), the first CAS is seeded from the preload, and identical attribution rows are skipped. A create race between the scanner and node sync now merges into the winning row instead of dropping the loser's IPs, which on PostgreSQL also aborted the scanner's whole scan transaction. Closes #6927
This commit is contained in:
@@ -86,6 +86,12 @@ fields) is pushed to child nodes verbatim, so the node's Xray records the real I
|
||||
parent panel pulls each node's per-client IPs roughly every 10 seconds. The real visitor IP
|
||||
shows up on the parent automatically.
|
||||
|
||||
Reports retain each address's newest timestamp within the 30-minute retention window.
|
||||
Flat and per-node IP blobs use a stable timestamp-ascending order, with IP text breaking
|
||||
ties, so equivalent reports preserve the same bytes and skip redundant writes. Flat-row
|
||||
merges use compare-and-set retries to preserve concurrent observations; advancing a
|
||||
timestamp remains a real change. GUID attribution stays separate from the flat union.
|
||||
|
||||
## Security note
|
||||
|
||||
Both `acceptProxyProtocol` and `trustedXForwardedFor` are **server-side only** — they are
|
||||
|
||||
Reference in New Issue
Block a user