mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-12-17 20:54:40 +03:00
fix: improve error handling in periodic traffic reset job (#3572)
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user