change job run time

This commit is contained in:
Hossin Asaadi
2022-11-04 10:13:17 -04:00
parent d564956134
commit 131a9aeefe
2 changed files with 3 additions and 18 deletions

View File

@@ -104,7 +104,7 @@ func processLogFile() {
// check if inbound connection is more than limited ip and drop connection
LimitDevice := func() { LimitDevice() }
stop := schedule(LimitDevice, 1000 *time.Millisecond)
stop := schedule(LimitDevice, 700 *time.Millisecond)
time.Sleep(60 * time.Second)
stop <- true
@@ -213,21 +213,6 @@ func GetInboundByEmail(clientEmail string) (*model.Inbound, error) {
return inbounds, nil
}
func DisableInbound(id int) error {
db := database.GetDB()
result := db.Model(model.Inbound{}).
Where("id = ? and enable = ?", id, true).
Update("enable", false)
err := result.Error
logger.Warning("disable inbound with id:",id)
if err == nil {
job.xrayService.SetToNeedRestart()
}
return err
}
func LimitDevice(){
localIp,err := LocalIP()

View File

@@ -296,8 +296,8 @@ func (s *Server) startTask() {
// 每 30 秒检查一次 inbound 流量超出和到期的情况
s.cron.AddJob("@every 30s", job.NewCheckInboundJob())
// check client ips from log file every 1 min
s.cron.AddJob("@every 1m", job.NewCheckClientIpJob())
// check client ips from log file every 30 sec
s.cron.AddJob("@every 30s", job.NewCheckClientIpJob())
// 每一天提示一次流量情况,上海时间8点30
var entry cron.EntryID