mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-10-13 19:49:12 +00:00
fix: improve error handling in periodic traffic reset job (#3572)
Some checks are pending
Release 3X-UI / build (386) (push) Waiting to run
Release 3X-UI / build (amd64) (push) Waiting to run
Release 3X-UI / build (arm64) (push) Waiting to run
Release 3X-UI / build (armv5) (push) Waiting to run
Release 3X-UI / build (armv6) (push) Waiting to run
Release 3X-UI / build (armv7) (push) Waiting to run
Release 3X-UI / build (s390x) (push) Waiting to run
Release 3X-UI / Build for Windows (push) Waiting to run
Some checks are pending
Release 3X-UI / build (386) (push) Waiting to run
Release 3X-UI / build (amd64) (push) Waiting to run
Release 3X-UI / build (arm64) (push) Waiting to run
Release 3X-UI / build (armv5) (push) Waiting to run
Release 3X-UI / build (armv6) (push) Waiting to run
Release 3X-UI / build (armv7) (push) Waiting to run
Release 3X-UI / build (s390x) (push) Waiting to run
Release 3X-UI / Build for Windows (push) Waiting to run
This commit is contained in:
parent
cafcb250ec
commit
a824875c4f
1 changed files with 11 additions and 5 deletions
|
@ -37,13 +37,19 @@ func (j *PeriodicTrafficResetJob) Run() {
|
||||||
resetCount := 0
|
resetCount := 0
|
||||||
|
|
||||||
for _, inbound := range inbounds {
|
for _, inbound := range inbounds {
|
||||||
if err := j.inboundService.ResetAllClientTraffics(inbound.Id); err != nil {
|
resetInboundErr := j.inboundService.ResetAllTraffics()
|
||||||
logger.Warning("Failed to reset traffic for inbound", inbound.Id, ":", err)
|
if resetInboundErr != nil {
|
||||||
continue
|
logger.Warning("Failed to reset traffic for inbound", inbound.Id, ":", resetInboundErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
resetCount++
|
resetClientErr := j.inboundService.ResetAllClientTraffics(inbound.Id)
|
||||||
logger.Infof("Reset traffic for inbound %d (%s)", inbound.Id, inbound.Remark)
|
if resetClientErr != nil {
|
||||||
|
logger.Warning("Failed to reset traffic for all users of inbound", inbound.Id, ":", resetClientErr)
|
||||||
|
}
|
||||||
|
|
||||||
|
if resetInboundErr == nil && resetClientErr == nil {
|
||||||
|
resetCount++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if resetCount > 0 {
|
if resetCount > 0 {
|
||||||
|
|
Loading…
Reference in a new issue