Skip to content

Commit 656b1fa

Browse files
authored
fix(dataobj): Fix shutdown race in dataobj consumer (#16157)
1 parent 82cfaea commit 656b1fa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎pkg/dataobj/consumer/service.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ func (s *Service) handlePartitionsAssigned(ctx context.Context, client *kgo.Clie
109109

110110
func (s *Service) handlePartitionsRevoked(partitions map[string][]int32) {
111111
level.Info(s.logger).Log("msg", "partitions revoked", "partitions", formatPartitionsMap(partitions))
112+
if s.State() == services.Stopping {
113+
// On shutdown, franz-go will send one more partitionRevoked event which we need to ignore to shutdown gracefully.
114+
return
115+
}
112116
s.partitionMtx.Lock()
113117
defer s.partitionMtx.Unlock()
114118

0 commit comments

Comments
 (0)