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

This commit is contained in:
Vadim Iskuchekov 2025-10-01 23:12:09 +02:00 committed by GitHub
parent cafcb250ec
commit a824875c4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)
} }
resetClientErr := j.inboundService.ResetAllClientTraffics(inbound.Id)
if resetClientErr != nil {
logger.Warning("Failed to reset traffic for all users of inbound", inbound.Id, ":", resetClientErr)
}
if resetInboundErr == nil && resetClientErr == nil {
resetCount++ resetCount++
logger.Infof("Reset traffic for inbound %d (%s)", inbound.Id, inbound.Remark) }
} }
if resetCount > 0 { if resetCount > 0 {