Skip to content

Commit

Permalink
fix: cleanup canary out of range error
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra committed Feb 2, 2024
1 parent 650f20e commit d04a1ac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/topology/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ var CleanupCanaries = &job.Job{
Retention: job.Retention3Day,
RunNow: true,
Fn: func(ctx job.JobRuntime) error {
retention := ctx.Properties().Duration("canary.retention.age", DefaultRetention)
tx := ctx.DB().Exec(`
DELETE FROM canaries
WHERE
id NOT IN (SELECT canary_id FROM checks) AND
(NOW() - deleted_at) > INTERVAL '1 day' * ?
`, ctx.Properties().Duration("canary.retention.age", DefaultRetention))
(NOW() - deleted_at) > INTERVAL '1 second' * ?
`, int64(retention.Seconds()))

ctx.History.SuccessCount = int(tx.RowsAffected)
return tx.Error
Expand Down

0 comments on commit d04a1ac

Please sign in to comment.