add locking

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-09-15 18:38:35 +03:00
parent c89df95fdc
commit b445a7eeb7

View File

@ -50,8 +50,11 @@ func (s *subscriber) run(ctx context.Context) {
return
}
s.kopts.Logger.Infof(ctx, "handle fetches")
fetches.EachPartition(func(p kgo.FetchTopicPartition) {
s.Lock()
consumers := s.consumers[p.Topic]
s.Unlock()
if consumers == nil {
return
}