perf(inbounds): batch client identities for stats enrichment (#6929)

backfillClientStats loaded every column of every client once per inbound,
although enrichment only reads UUID, email and subscription ID. Each inbound
list read (panel list, the master's node traffic poll, Xray config builds,
bots) repeated that wide join per inbound. Identities now come from one narrow
clients/client_inbounds projection per 400 inbounds, honouring the supplied
transaction; stats output, sibling-traffic append order and the #6436
clients-table source of truth are unchanged.

Closes #6926
This commit is contained in:
Hamed
2026-10-25 16:31:46 +03:30
committed by GitHub
parent be25314157
commit 952c1c751a
11 changed files with 561 additions and 38 deletions
+6
View File
@@ -320,6 +320,12 @@ Restart is debounced via an atomic "need restart" flag (`SetToNeedRestart` /
**Key files:** `service/xray.go` (orchestration), `xray/hot_diff.go` (the diff algorithm),
`xray/process.go` (process lifecycle), `xray/api.go` (gRPC calls), `xray/config.go` (config model).
Inbound-list statistics read only UUID, email and subscription ID from `clients`, joined
through `client_inbounds` in batches of up to 400 distinct inbound IDs. Full client records
remain the source for Xray and subscriptions. Missing shared-client traffic is fetched by
email, including rows owned by an inbound outside the requested list; enrichment preserves
the stored traffic, lifecycle and last-online fields.
### 5.2 Runtime abstraction — Local vs Remote (multi-node) ⭐ most important
A "node" (`model.Node`) is another 3x-ui instance this panel controls. Every state-changing