fix(dataobj): Fix shutdown race in dataobj consumer (#16157)

pull/16158/head
benclive 11 months ago committed by GitHub
parent 82cfaea595
commit 656b1faaaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      pkg/dataobj/consumer/service.go

@ -109,6 +109,10 @@ func (s *Service) handlePartitionsAssigned(ctx context.Context, client *kgo.Clie
func (s *Service) handlePartitionsRevoked(partitions map[string][]int32) {
level.Info(s.logger).Log("msg", "partitions revoked", "partitions", formatPartitionsMap(partitions))
if s.State() == services.Stopping {
// On shutdown, franz-go will send one more partitionRevoked event which we need to ignore to shutdown gracefully.
return
}
s.partitionMtx.Lock()
defer s.partitionMtx.Unlock()

Loading…
Cancel
Save