mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-08-30 14:56:17 +00:00
added 5 seconds delay before cleaning logs
This commit is contained in:
parent
26d12120fd
commit
289a33675f
2 changed files with 5 additions and 2 deletions
|
@ -12,6 +12,7 @@ import (
|
||||||
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CheckClientIpJob struct {
|
type CheckClientIpJob struct {
|
||||||
|
@ -98,6 +99,8 @@ func processLogFile() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
time.Sleep(time.Second * 5)
|
||||||
|
//added 5 seconds delay before cleaning logs to reduce chance of logging IP that already has been banned
|
||||||
if shouldCleanLog {
|
if shouldCleanLog {
|
||||||
// clean log
|
// clean log
|
||||||
if err := os.Truncate(GetAccessLogPath(), 0); err != nil {
|
if err := os.Truncate(GetAccessLogPath(), 0); err != nil {
|
||||||
|
|
|
@ -250,7 +250,7 @@ func (s *Server) startTask() {
|
||||||
// Check the inbound traffic every 30 seconds that the traffic exceeds and expires
|
// Check the inbound traffic every 30 seconds that the traffic exceeds and expires
|
||||||
s.cron.AddJob("@every 30s", job.NewCheckInboundJob())
|
s.cron.AddJob("@every 30s", job.NewCheckInboundJob())
|
||||||
|
|
||||||
// check client ips from log file every 10 sec
|
// check client ips from log file every 30 sec
|
||||||
s.cron.AddJob("@every 30s", job.NewCheckClientIpJob())
|
s.cron.AddJob("@every 30s", job.NewCheckClientIpJob())
|
||||||
|
|
||||||
// Make a traffic condition every day, 8:30
|
// Make a traffic condition every day, 8:30
|
||||||
|
|
Loading…
Reference in a new issue