mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-04 04:23:02 +00:00
updage
This commit is contained in:
@@ -3,6 +3,7 @@ package scheduler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/robfig/cron/v3"
|
||||
@@ -49,9 +50,11 @@ func (s *Scheduler) Start(ctx context.Context) error {
|
||||
schedule = "@every " + s.config.Interval.String()
|
||||
}
|
||||
|
||||
s.cron.AddFunc(schedule, func() {
|
||||
if _, err := s.cron.AddFunc(schedule, func() {
|
||||
s.syncAll(ctx)
|
||||
})
|
||||
}); err != nil {
|
||||
return fmt.Errorf("failed to schedule sync job: %w", err)
|
||||
}
|
||||
|
||||
s.cron.Start()
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user