Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
change job run time
Browse files Browse the repository at this point in the history
  • Loading branch information
hossinasaadi committed Nov 4, 2022
1 parent d564956 commit 131a9ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
17 changes: 1 addition & 16 deletions web/job/check_clinet_ip_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 131a9ae

Please sign in to comment.