stoewer/go-nakadi

Make retry for `CommitCursor` optional

Closed this issue · 3 comments

Retries with exponential back-off can be turned in all sub APIs of go-nakadi, the only exception is the method CommitCursor of the StreamAPI where retries are enabled all the time. In order to be more consistent with other sub APIs, retries should be also optional for CommitCursor.

The option struct StreamOptions must have a field CommitRetry and retry should only be enabled of the field is set to true.

What would this involve, aside from adding CommitRetry bool to the StreamOptions struct ? How should I test the functionality in streams_test ?

I'm new to golang, and want to take this opportunity to learn it, thank you ahead of time for you patience.

What would this involve, aside from adding CommitRetry bool to the StreamOptions struct ? How should I test the functionality in streams_test ?

Adding CommitRetry to the options is just the first step. The second is to actually prevent the retry, this can be achieved by initializing the commitBackOff with a backoff.StopBackOff instead of the currently used exponential back-off (unless of course CommitRetry is true).

Regarding the tests: this is actually not so easy to test. But one could check what kind of back-off commitBackOff is.

I'm new to golang, and want to take this opportunity to learn it, thank you ahead of time for you patience.

No worries, just give it a try and make a pull request. If you have any further questions just ask.

Thank you, I'll be working on this as well.