mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #4387] [MERGED] fix: prevent online clients from randomly disappearing from panel UI #5680
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5680
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/4387
Author: @abdalrahmanx9
Created: 5/14/2026
Status: ✅ Merged
Merged: 5/15/2026
Merged by: @MHSanaei
Base:
main← Head:fix/online-clients-disappearing📝 Commits (2)
e5778b1fix: prevent online clients from randomly disappearing from panel UIa84c24dfix: extend online client grace period to survive idle poll cycles📊 Changes
3 files changed (+38 additions, -18 deletions)
View changed files
📝
web/job/node_traffic_sync_job.go(+7 -4)📝
web/job/xray_traffic_job.go(+11 -4)📝
web/service/inbound.go(+20 -10)📄 Description
Summary
lastOnlineDB timestamps with a 5-second grace period instead of being replaced each cycle with only the current traffic poll active clientsCloses #4384
Problem
addClientTraffic()inweb/service/inbound.godetermined "online" status solely based on whether a client transferred bytes in the current 5-second polling window:len(traffics) == 0, ALL online clients were immediately cleared viap.SetOnlineClients(make([]string, 0))p.SetOnlineClients(onlineClients)with only clients who hadUp+Down > 0in that exact poll — completely replacing the previous listChanges
web/service/inbound.go:p.SetOnlineClients(make([]string, 0))— online clients are no longer wiped on empty traffic pollsp.SetOnlineClients(onlineClients)—addClientTrafficnow only handles traffic accounting, not online managementonlineGracePeriodMs = 5000constantRefreshOnlineClientsFromMap()that determines online clients fromlastOnlinetimestamps with the grace periodweb/job/xray_traffic_job.go:lastOnlineMap, callsRefreshOnlineClientsFromMap()to compute online clients from persisted timestampsGetOnlineClients()still merges local + remote node online data for multi-node deploymentsweb/job/node_traffic_sync_job.go:🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.