pulsar-client-go
pulsar-client-go copied to clipboard
improve: use ctx and timer instead sleep
Motivation
We are using time.Sleep and for to execute the retry, which cannot be interrupted, this PR will use context and timer to improve this behavior.
The next improvement idea supports passing the context to interrupt the retry, when closing the producer or consumer, we need to do that.
Modifications
- Add the
Retrymethod to execute the try, and useRetryinstead oftime.Sleepandfor.
Let me fix the consumer seek test first.
Seek test will be fixed by #1265.
@RobertIndie @crossoverJie Could you have a chance to review?