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
+2 -2
View File
@@ -14,7 +14,7 @@ func NewCronJob() *CronJob {
return &CronJob{}
}
func (c *CronJob) Start(loc *time.Location) error {
func (c *CronJob) Start(loc *time.Location, trafficAge int) error {
c.cron = cron.New(cron.WithLocation(loc), cron.WithSeconds())
c.cron.Start()
@@ -24,7 +24,7 @@ func (c *CronJob) Start(loc *time.Location) error {
// Start expiry job
c.cron.AddJob("@every 1m", NewDepleteJob())
// Start deleting old stats
c.cron.AddJob("@daily", NewDelStatsJob())
c.cron.AddJob("@daily", NewDelStatsJob(trafficAge))
}()
return nil