You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a wrapper function of sendMessage to produce messages with a tracer. (attached below)
Since the ppsarama.WithContext(ctx, producer) access the ctx inside of producer, the data race will occur when I run this function with multiple goroutines.
It would be lovely if I can pass the context to SendMessage function, but it seems syncProducer interface doesn't support the context.
I can make a lock with mutex before the WithContext, but is there a way to prevent this without a lock?
In order to minimize modification of the application, the syncProducer interface of plugin was made to be the same as sarama's api. I think I need to add a new api to solve the problem.
I will provide a new SendMessageWithContext(ctx context.Context, ...) function.
Description
I have a wrapper function of sendMessage to produce messages with a tracer. (attached below)
Since the
ppsarama.WithContext(ctx, producer)
access the ctx inside of producer, the data race will occur when I run this function with multiple goroutines.It would be lovely if I can pass the context to
SendMessage
function, but it seems syncProducer interface doesn't support the context.I can make a lock with mutex before the
WithContext
, but is there a way to prevent this without a lock?The text was updated successfully, but these errors were encountered: