diff options
Diffstat (limited to 'web/job')
| -rw-r--r-- | web/job/check_inbound_job.go | 37 | ||||
| -rw-r--r-- | web/job/xray_traffic_job.go | 8 |
2 files changed, 3 insertions, 42 deletions
diff --git a/web/job/check_inbound_job.go b/web/job/check_inbound_job.go deleted file mode 100644 index 2044ce68..00000000 --- a/web/job/check_inbound_job.go +++ /dev/null @@ -1,37 +0,0 @@ -package job - -import ( - "x-ui/logger" - "x-ui/web/service" -) - -type CheckInboundJob struct { - xrayService service.XrayService - inboundService service.InboundService -} - -func NewCheckInboundJob() *CheckInboundJob { - return new(CheckInboundJob) -} - -func (j *CheckInboundJob) Run() { - needRestart, count, err := j.inboundService.DisableInvalidClients() - if err != nil { - logger.Warning("Error in disabling invalid clients:", err) - } else if count > 0 { - logger.Debugf("%v clients disabled", count) - if needRestart { - j.xrayService.SetToNeedRestart() - } - } - - needRestart, count, err = j.inboundService.DisableInvalidInbounds() - if err != nil { - logger.Warning("Error in disabling invalid inbounds:", err) - } else if count > 0 { - logger.Debugf("%v inbounds disabled", count) - if needRestart { - j.xrayService.SetToNeedRestart() - } - } -} diff --git a/web/job/xray_traffic_job.go b/web/job/xray_traffic_job.go index 3acdf44a..158930a4 100644 --- a/web/job/xray_traffic_job.go +++ b/web/job/xray_traffic_job.go @@ -24,14 +24,12 @@ func (j *XrayTrafficJob) Run() { logger.Warning("get xray traffic failed:", err) return } - err = j.inboundService.AddTraffic(traffics) + err, needRestart := j.inboundService.AddTraffic(traffics, clientTraffics) if err != nil { logger.Warning("add traffic failed:", err) } - - err = j.inboundService.AddClientTraffic(clientTraffics) - if err != nil { - logger.Warning("add client traffic failed:", err) + if needRestart { + j.xrayService.SetToNeedRestart() } } |
