added 5 seconds delay before cleaning logs

This commit is contained in:
somebodywashere 2023-06-14 09:26:21 +00:00
parent 26d12120fd
commit 289a33675f
2 changed files with 5 additions and 2 deletions

View file

@ -12,6 +12,7 @@ import (
"sort"
"strings"
"time"
)
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 {
// clean log
if err := os.Truncate(GetAccessLogPath(), 0); err != nil {

View file

@ -250,7 +250,7 @@ func (s *Server) startTask() {
// Check the inbound traffic every 30 seconds that the traffic exceeds and expires
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())
// Make a traffic condition every day, 8:30