fix PeriodicTrafficResetJob: log only when there are matching inbound

This commit is contained in:
mhsanaei 2025-09-18 11:41:11 +02:00
parent 99c79d4056
commit 170d24499e
No known key found for this signature in database
GPG key ID: D875CD086CF668A0

View file

@ -20,12 +20,16 @@ func NewPeriodicTrafficResetJob(period Period) *PeriodicTrafficResetJob {
func (j *PeriodicTrafficResetJob) Run() { func (j *PeriodicTrafficResetJob) Run() {
inbounds, err := j.inboundService.GetInboundsByTrafficReset(string(j.period)) inbounds, err := j.inboundService.GetInboundsByTrafficReset(string(j.period))
logger.Infof("Running periodic traffic reset job for period: %s", j.period)
if err != nil { if err != nil {
logger.Warning("Failed to get inbounds for traffic reset:", err) logger.Warning("Failed to get inbounds for traffic reset:", err)
return return
} }
if len(inbounds) == 0 {
return
}
logger.Infof("Running periodic traffic reset job for period: %s (%d matching inbounds)", j.period, len(inbounds))
resetCount := 0 resetCount := 0
for _, inbound := range inbounds { for _, inbound := range inbounds {