mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #7028] [Feature]: Make the external traffic inform interval configurable and independent from Xray traffic polling #4625
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#4625
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 @fq0222 on GitHub (Oct 30, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/7028
Feature description
Please add a configurable interval for External Traffic Inform (
ExternalTrafficInformEnable/ExternalTrafficInformURI).Currently, the external traffic webhook is called from
XrayTrafficJob, which runs every 5 seconds:This couples two different concerns:
The internal Xray traffic collection should continue running every 5 seconds. However, the external traffic notification should have its own configurable interval.
Proposed behavior
Add a setting such as:
Suggested behavior:
Example:
In this example, 3x-ui still updates local traffic, online state, and quota enforcement every 5 seconds, but sends one aggregated external notification every 60 seconds.
Motivation
Sending one HTTP request every 5 seconds from every panel or node can create unnecessary load on the receiving service, especially in multi-node deployments.
For example:
Many external billing and subscription systems do not require five-second updates. A separate configurable interval would reduce network and receiver load without delaying local quota enforcement.
Alternatives considered
Changing cadenceXrayTraffic itself is not suitable because it would also delay:
Therefore, the external notification schedule should be decoupled from the internal Xray traffic polling schedule.
Related issue
@github-actions[bot] commented on GitHub (Oct 30, 2026):
This is a valid feature request. The current code works the way you describe: the external traffic POST runs inside the 5-second
XrayTrafficJob, and no setting changes how often it fires.What the code does today
cadenceXrayTraffic = "@every 5s"(internal/web/web.go:305). It is registered once withs.cron.AddJob(cadenceXrayTraffic, job.NewXrayTrafficJob())(internal/web/web.go:342).internal/web/job/xray_traffic_job.go:103-104):externalTrafficInformEnableandexternalTrafficInformURI(internal/web/service/setting.go:203-204). There is no interval key.xray_traffic_job.go:228). Xray reports a row for every known email even when it moved no bytes (see the comment atxray_traffic_job.go:35-36), so with any clients configured the receiver gets a request on almost every 5s tick.Points for whoever builds this
DoTimeoutfails (xray_traffic_job.go:255-256), the delta is logged and discarded, with no retry and no buffer. Your "receiver must not lose deltas" requirement therefore needs an accumulate-and-resend buffer for failures too, not just for a longer interval.0e69f64e) it is capped atexternalInformTimeout = 3 * time.Second(xray_traffic_job.go:57), but a slow receiver can still delay the WebSocket broadcast later in the sameRun()by up to 3s. Moving the inform onto its own schedule would also remove that coupling.setting.godefaults, a field inentity.AllSetting(internal/web/entity/entity.go:115-116), a settings-UI field, and i18n keys in all 14 locale files.Related: #6115 (bounded the POST's timeout but left the cadence alone) and #3197 (how to use the feature). I found no duplicate.
Verdict: Feature request
This reply was generated automatically; a maintainer may follow up.