Hi, now i am working on library which are rely on this. I want to close all my library channels only after consumer really stop consuming loop. For example:
err := consuming.consumer.StopConsuming(immediately, flushMessages)
if err != nil {
return errors.WithMessage(err, "stop consumer")
}
// NOTE: do not close output channel while underlying consumer really stops
for consuming.consumer.Started() {
time.Sleep(10 * time.Millisecond)
}
close(consuming.outputChan)
And now, when i run tests, i've got a data-race, because i want to read variable Started, and at the same time this variable changed by consumer.
Hi, now i am working on library which are rely on this. I want to close all my library channels only after consumer really stop consuming loop. For example:
And now, when i run tests, i've got a data-race, because i want to read variable Started, and at the same time this variable changed by consumer.