go-workers icon indicating copy to clipboard operation
go-workers copied to clipboard

Retry options

Open wayt opened this issue 8 years ago • 2 comments

Hi,

I've been looking at the retry options and I've face something strange. Maybe I just misunderstood.

In https://github.com/jrallison/go-workers/blob/master/enqueue.go#L24 you can specify if you wish to retry the task, and the max number of retry. But, in https://github.com/jrallison/go-workers/blob/master/middleware_retry.go#L58 the retry_count option is used as the actual number of time the job have been tried. With this, we can't configure a custom retry count, and I don't really see the point of the RetryCount in EnqueueOptions.

Thanks

wayt avatar Aug 18 '16 09:08 wayt

If I'm reading the sidekiq code correctly, retry_count is indeed the current count. Sidekiq allows the retry value to be either a boolean or an integer. go-workers accepts either boolean or integer values in the queued jobs, but only allows the retry option to be specified as a boolean from Go clients. So, your choices are 25 or 0.

rowland avatar May 16 '17 06:05 rowland

@rowland would you know why go-workers would allow setting RetryCount (retry_count) directly through EnqeueOptions? Seems to me as if EnqueueOptions should only be setting retry. The retry middleware seems to increment retry-count from the message. https://github.com/jrallison/go-workers/blob/287ed37cbdd72e67c1679ced0a12352a255abfe3/middleware_retry.go#L74

I tried to fix it by using RetryCount set to retry here.

https://github.com/rahuljayaraman/go-workers/commit/5b58974acce15841c98ea81543c73014f566db4e

rahuljayaraman avatar Apr 25 '18 05:04 rahuljayaraman