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

Loading…
Cancel
Save