mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5571] [Question]: “Old users’ usage volume is not syncing.” #3890
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#3890
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?
Originally created by @Shm9220 on GitHub (Jun 25, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5571
What are you trying to do?
“I have a server that had a panel and users on it. I turned it into a node connected to a main server, and the inbound and users got synced. But the users’ usage volume on the main server started from zero.
So basically it brought the users and synced them on the main server, but it didn’t bring their consumed traffic/usage. For example, if a user had 30 GB usage on the node server, on the main server it started from zero again.”
من یه سرور دارم که روش پنل و یوزر بود کردمش نود یه سرور اصلی و اینباند و یوزرش سینک شد
.ولی حجم مصرفیش رو سرور مادر از صفر شروع شده
ینی خود یوزر رو آورد سینک کرد رو سرور مادر ولی حجم مصرفیش رو نیاورد
مثلا اگه روی سرور نود کاربر ۳۰ گیگ مصرفش بود ٫
روی سرور مادر شروع کرد از صفر
What have you already tried?
No response
3x-ui version
3.4.0
How did you install 3x-ui?
install.sh script
Operating system
No response
Screenshots or config snippets
No response
Before submitting
@github-actions[bot] commented on GitHub (Jun 25, 2026):
The behavior you are seeing is intentional. When a server that already has clients and traffic history is joined to a main panel as a node, the main panel initializes each client's traffic counter at zero on the first sync and records the node's current cumulative counter as a baseline in the
node_client_trafficstable. Only traffic accumulated after that first sync is credited on the main panel.This is confirmed directly in the source:
internal/web/service/inbound_node.go, lines 619–646 (setRemoteTrafficLocked): when a client email is seen for the first time on a node, a newclient_trafficsrow is created withUp: 0, Down: 0, andupsertNodeBaselinestores the node's current counter as the starting point.internal/web/service/node_client_traffic_sum_test.go, line 100: the test explicitly asserts0, 0after the first sync with the comment"after baselines — historical node traffic not imported".Subsequent syncs compute
delta = current_node_counter − baselineand add only that increment to the main panel's counter. The design avoids false inflation from stale counters (for example, a client deleted on the main panel but still tracked on the node).There is no built-in mechanism to import pre-node historical traffic. If you need those accumulated totals to appear on the main panel, the only option is a direct database edit:
If the main panel uses PostgreSQL (
XUI_DB_TYPE=postgres), the sameUPDATEquery applies against that database instead.This direct database edit is not supported through the panel UI and should be done with care.
رفتاری که مشاهده میکنید طراحیشده و عمدی است. وقتی یک سرور مستقل که کاربران و ترافیک دارد بهعنوان نود به پنل اصلی اضافه میشود، در اولین سینک، پنل اصلی مقدار مصرف هر کاربر را از صفر شروع میکند و مقدار فعلی شمارنده ترافیک نود را بهعنوان پایه (baseline) ذخیره میکند. فقط ترافیکی که بعد از اولین سینک مصرف شود در پنل اصلی حساب میشود.
این رفتار در کد منبع (
internal/web/service/inbound_node.go، خطوط ۶۱۹–۶۴۶) تأیید شده است و یک تصمیم طراحی آگاهانه است تا از ثبت اشتباه ترافیکهای قدیمی یا حذفشده جلوگیری شود.برای اضافهکردن دستی ترافیک تاریخی، تنها راه ویرایش مستقیم جدول
client_trafficsدر پایگاهداده پنل اصلی است (دستورات بالا). پیش از هر تغییری از فایلx-ui.dbنسخه پشتیبان تهیه کنید.This reply was generated automatically; a maintainer may follow up.
@MHSanaei commented on GitHub (Jun 25, 2026):
b32837e523