Skip to content

Commit

Permalink
Fix garbage collection logic for matching tasks (#5355)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaddoll committed Jul 19, 2023
1 parent 497aff1 commit 25e69ba
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions service/matching/taskGC.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@ func (tgc *taskGC) tryDeleteNextBatch(ackLevel int64, ignoreTimeCond bool) {
return
}
tgc.lastDeleteTime = time.Now()
n, err := tgc.db.CompleteTasksLessThan(ackLevel, batchSize)
switch {
case err != nil:
return
case n < batchSize:
tgc.ackLevel = ackLevel
for {
n, err := tgc.db.CompleteTasksLessThan(ackLevel, batchSize)
if err != nil {
break
}
if n < batchSize {
tgc.ackLevel = ackLevel
break
}
}
}

Expand Down

0 comments on commit 25e69ba

Please sign in to comment.