go-workers
go-workers copied to clipboard
Retry options
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
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 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