optional store traffic time

This commit is contained in:
Alireza Ahmadi
2024-04-25 21:10:02 +02:00
parent abb869c75b
commit 9a02e6593c
10 changed files with 41 additions and 6 deletions
+6 -3
View File
@@ -7,14 +7,17 @@ import (
type DelStatsJob struct {
service.StatsService
trafficAge int
}
func NewDelStatsJob() *DelStatsJob {
return &DelStatsJob{}
func NewDelStatsJob(ta int) *DelStatsJob {
return &DelStatsJob{
trafficAge: ta,
}
}
func (s *DelStatsJob) Run() {
err := s.StatsService.DelOldStats(30)
err := s.StatsService.DelOldStats(s.trafficAge)
if err != nil {
logger.Warning("Deleting old statistics failed: ", err)
return