feat(backend): trigger startup snapshot job in a goroutine (#2309)

* feat(backend): wrap init enpoint with goroutine

* feat(backend): wrap job snapshot with goroutine

* feat(snapshots): reset changes for main and job_endpoint

* feat(snapshot): run first job.snapshot as a goroutine
pull/2322/head
Chaim Lev-Ari 6 years ago committed by Anthony Lapenna
parent 9b4870d57e
commit bad95987ec

@ -45,11 +45,7 @@ func (scheduler *JobScheduler) ScheduleEndpointSyncJob(endpointFilePath string,
// ScheduleSnapshotJob schedules a cron job to create endpoint snapshots
func (scheduler *JobScheduler) ScheduleSnapshotJob(interval string) error {
job := newEndpointSnapshotJob(scheduler.endpointService, scheduler.snapshotter)
err := job.Snapshot()
if err != nil {
return err
}
go job.Snapshot()
return scheduler.cron.AddJob("@every "+interval, job)
}

Loading…
Cancel
Save