We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0fef7aa + b7ce3d5 commit ec36595Copy full SHA for ec36595
pkg/kgo/source.go
@@ -788,6 +788,14 @@ func (s *source) loopFetch() {
788
s.fetchState.hardFinish()
789
return
790
case doneFetch := <-canFetch:
791
+ // Perform another last minute best-effort check on session context
792
+ // to avoid calling fetch with a canceled context just because it passed
793
+ // the above selects by chance due to pseudo-random select behavior.
794
+ if session.ctx.Err() != nil {
795
+ doneFetch <- struct{}{}
796
+ s.fetchState.hardFinish()
797
+ return
798
+ }
799
again = s.fetchState.maybeFinish(s.fetch(session, doneFetch))
800
}
801
0 commit comments