mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #5496] [CLOSED] fix(job): handle access-log errors and resolve IP-limit clients relationally #5904
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#5904
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/5496
Author: @n0ctal
Created: 6/22/2026
Status: ❌ Closed
Base:
main← Head:pr-0016-iplimit-job-hardening📝 Commits (2)
69c10f9fix(job): handle access-log errors and resolve IP-limit clients relationallyfe0197aMerge branch 'main' into pr-0016-iplimit-job-hardening📊 Changes
2 files changed (+108 additions, -13 deletions)
View changed files
📝
internal/web/job/check_client_ip_job.go(+63 -13)📝
internal/web/job/check_client_ip_job_integration_test.go(+45 -0)📄 Description
Summary
The client IP-limit job ignored errors when opening/copying/truncating the Xray access log, and located a client's inbound with a fragile
settings LIKE '%email%'substring query. This adds error handling with early returns, verifies the access log is actually readable, and resolves the client-to-inbound mapping via theclients/client_inboundsrelation, keeping the substring scan only as a fallback.Why
j.checkError(err)with no return) let the job keep running after a failed log open/copy/truncate, operating on inconsistent state.WHERE settings LIKE '%email%'can match the wrong inbound: an email that is a substring of another email, or text that merely appears elsewhere in the settings JSON. The relational lookup is exact; the JSON scan remains as a fallback so nothing regresses when the relation has no row.Scope
internal/web/job/check_client_ip_job.go:clearAccessLog,processLogFile: check each file error and return early instead of continuing.checkAccessLogAvailable: actually open the log to confirm readability (not just stat).getInboundByEmail: joinclient_inbounds/clientsonclients.email; on miss fall back to the previousLIKE+ JSON parse.internal/web/job/check_client_ip_job_integration_test.go: integration coverage.Validation
go vet ./internal/web/job/,go build ./..., and the fullinternal/web/jobpackage under-raceall pass.Risk
getInboundByEmailnow prefers the relational tables and falls back to the prior substring+JSON scan, so the result is unchanged when the join finds nothing. No schema change; no behavioral change for the common single-match case.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.