Skip to content

Commit

Permalink
chore: return deleted rows if stale history cleanup fails (#1025)
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra authored Sep 6, 2024
1 parent 69d61a0 commit 9c8049b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions job/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ func CleanupStaleAgentHistory(ctx context.Context, itemsToRetain int) (int, erro
// We are deleting in batches since the query can timeout if size is too high
deleted := 0
for {
res := ctx.FastDB("jobs").Exec(query, itemsToRetain, uuid.Nil)
// TODO (yashmehrotra): Use FastDB after debugging job failure
//res := ctx.FastDB("jobs").Exec(query, itemsToRetain, uuid.Nil)
res := ctx.DB().Exec(query, itemsToRetain, uuid.Nil)
if res.Error != nil {
return 0, db.ErrorDetails(res.Error)
return deleted, db.ErrorDetails(res.Error)
}
deleted += int(res.RowsAffected)
if res.RowsAffected == 0 {
Expand Down

0 comments on commit 9c8049b

Please sign in to comment.