Skip to content

Commit fc0a885

Browse files
authored
Avoid finalGC when ack level is zero (#9371)
## What changed? When finishing draining, the drained queue may not have had any tasks at all. In that case don't try to do a GC. This is harmless but causes an error log. ## Why? Misleading error logs. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s)
1 parent 83174df commit fc0a885

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

service/matching/fair_task_reader.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,5 +680,8 @@ func (tr *fairTaskReader) finalGC() {
680680
tr.lock.Lock()
681681
ackLevel := tr.ackLevel
682682
tr.lock.Unlock()
683+
if ackLevel.pass == 0 {
684+
return
685+
}
683686
_, _ = tr.doGCAt(ackLevel)
684687
}

service/matching/pri_task_reader.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,5 +543,8 @@ func (tr *priTaskReader) finalGC() {
543543
tr.lock.Lock()
544544
ackLevel := tr.ackLevel
545545
tr.lock.Unlock()
546+
if ackLevel == 0 {
547+
return
548+
}
546549
_, _ = tr.doGCAt(ackLevel)
547550
}

0 commit comments

Comments
 (0)