Make scheduler optional (#251)

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2021-01-02 16:54:08 +01:00
committed by GitHub
parent 0cab1f8298
commit 072e5d6175
3 changed files with 9 additions and 4 deletions

View File

@@ -91,7 +91,10 @@ func (di *Diun) Start() error {
// Run on startup
di.Run()
// Init scheduler
// Init scheduler if defined
if len(di.cfg.Watch.Schedule) == 0 {
return nil
}
di.jobID, err = di.cron.AddJob(di.cfg.Watch.Schedule, di)
if err != nil {
return err