3x-ui/web/job
MHSanaei 934f9bc230
fix(online): refresh online-clients list even when no WS frontend is connected (#4515)
XrayTrafficJob and NodeTrafficSyncJob both gated the entire
post-traffic-write block behind websocket.HasClients() to skip
expensive broadcasts when no browser is open. The block included the
RefreshOnlineClientsFromMap call that keeps the in-memory
p.onlineClients list current.

Several non-WS consumers read that same list:
- Telegram bot (tgbot.go calls p.GetOnlineClients in 3 places)
- REST GET /panel/api/onlines (returned to API callers)
- Internal alerts that check whether a client is online

When no browser was watching the dashboard, the list went stale and
stayed empty, so the bot reported "nobody online" and the onlines API
returned [] even when xray had active sessions.

Move RefreshOnlineClientsFromMap above the HasClients guard so the
in-memory list is always fresh. Only the actual BroadcastTraffic /
BroadcastClientStats / BroadcastOutbounds calls (and the
GetAllClientTraffics / GetInboundsTrafficSummary work that feeds them)
remain gated by HasClients.

Closes #4515
2026-05-24 23:43:45 +02:00
..
check_client_ip_job.go fix(iplog): parse xray access-log timestamps in local time 2026-05-13 21:50:16 +02:00
check_client_ip_job_integration_test.go v3 2026-05-10 02:13:42 +02:00
check_client_ip_job_test.go iplimit: dont count idle db-only ips toward the per-client limit 2026-04-23 21:11:45 +03:00
check_cpu_usage.go v3 2026-05-10 02:13:42 +02:00
check_hash_storage.go fix: hash-storage panic on SIGHUP and seeder dup-key on cold restart (#4539) 2026-05-24 22:45:14 +02:00
check_hash_storage_test.go fix: hash-storage panic on SIGHUP and seeder dup-key on cold restart (#4539) 2026-05-24 22:45:14 +02:00
check_xray_running_job.go v3 2026-05-10 02:13:42 +02:00
clear_logs_job.go v3 2026-05-10 02:13:42 +02:00
ldap_sync_job.go Feat/multi inbound clients (#4469) 2026-05-19 12:20:24 +02:00
node_heartbeat_job.go feat(nodes): traffic-writer queue, full-mirror sync, WS event fixes 2026-05-10 16:25:23 +02:00
node_traffic_sync_job.go fix(online): refresh online-clients list even when no WS frontend is connected (#4515) 2026-05-24 23:43:45 +02:00
node_traffic_sync_job_test.go Feat/multi inbound clients (#4469) 2026-05-19 12:20:24 +02:00
periodic_traffic_reset_job.go Feat/multi inbound clients (#4469) 2026-05-19 12:20:24 +02:00
stats_notify_job.go v3 2026-05-10 02:13:42 +02:00
xray_traffic_job.go fix(online): refresh online-clients list even when no WS frontend is connected (#4515) 2026-05-24 23:43:45 +02:00