Skip to content

Commit

Permalink
Don't resume syncs that started over a week ago. (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreer authored Dec 30, 2024
1 parent 0c9a018 commit 988c9e4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/dotc1z/sync_runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ func (c *C1File) getLatestUnfinishedSync(ctx context.Context) (*syncRun, error)
return nil, err
}

// Don't resume syncs that started over a week ago
oneWeekAgo := time.Now().AddDate(0, 0, -7)
ret := &syncRun{}
q := c.db.From(syncRuns.Name())
q = q.Select("sync_id", "started_at", "ended_at", "sync_token")
q = q.Where(goqu.C("ended_at").IsNull())
q = q.Where(goqu.C("started_at").Gte(oneWeekAgo))
q = q.Order(goqu.C("started_at").Desc())
q = q.Limit(1)

Expand Down

0 comments on commit 988c9e4

Please sign in to comment.