Files
x-ui/web/service
shayan775 bcea56283f The too many SQL variables path is now batched.
Changed code:

Added safe batching limits in inbound.go:
safeSQLVariablesPerQuery = 900
safeSaveBatchSize = 50
Fixed addClientTraffic in inbound.go:
email IN (...) lookup is now chunked (line 815).
tx.Save(dbClientTraffics) is now chunked (line 859).
Added nil guard for p.SetOnlineClients(...) (line 855).
Hardened adjustTraffics in inbound.go:
deduplicates inbound IDs before querying (line 877).
chunked inbound IN query (line 890).
chunked inbound Save (line 932).
Added regression test:

inbound_add_client_traffic_test.go
Verifies 4,000 client traffic updates succeed and totals are correct.
Validation run:

go test ./web/service -run TestAddClientTrafficHandlesLargeBatch -count=1 passed
go test ./web/service -count=1 passed
2026-02-24 19:19:04 +03:30
..
2025-08-02 11:52:08 +02:00
2025-09-18 22:33:02 +02:00
2026-02-01 00:51:53 +01:00
2026-02-02 16:41:51 +01:00
2025-09-18 22:33:02 +02:00
2025-09-18 22:33:02 +02:00
2025-09-18 22:33:02 +02:00
2025-09-18 22:33:02 +02:00
2026-02-01 00:51:53 +01:00