-
Notifications
You must be signed in to change notification settings - Fork 1
Fix requeue #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix requeue #16
Conversation
Add ruby 2.1 to travis build.
Improve RetryExceptions middleware to support exception-dependent backoffs
Spawned from
This ensures that you’ll get an error if the job has already been cancelled, rather than resurrecting it.
Use qless core requeue
Retry and requeue callbacks
This ensures that you’ll get an error if the job has already been cancelled, rather than resurrecting it.
…ueue Conflicts: lib/qless/job.rb lib/qless/lua/qless-lib.lua lib/qless/lua/qless.lua
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it'd be worth DRYing this (this assumes that JSON.generate will handle primitives properly).
DEFAULT_OPTS = {
'priority' => 0,
'tags', => [],
# etc
}
def self.build_opts_array(opts)
DEFAULT_OPTS.reduce([opts.fetch(:delay, 0)]) do |result, (key, default)|
value = JSON.generate(opts.fetch(key.to_sym, default))
result << [key, value]
end
endIt'd be great if you could just slice out what you're interested in from the opts Hash and apply defaults for the missing values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed a little unsure of it atm. had to stop work mid way through the branch =) picking up the work again today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't work with base types so sad =(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YMMV, but the benefit of Hash#fetch comes in when you expect the value in the Hash to be false or nil sometimes, otherwise, might as well do opts[:depends] || []
@jzaleski, I miss you 💋
|
LGTM |
clean up enqueue option generation to make it less error prone, and easier to add new fields.