-
Notifications
You must be signed in to change notification settings - Fork 27
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
Adjust to new redlock behaviour #78
base: main
Are you sure you want to change the base?
Conversation
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.
Hey @nduitz
Thank you for the PR. I'm happy to accept it. But at the same time it would be nice to preserve compatibility with older versions of Ruby.
def handle_error(resource:, on_error:, error:) | ||
raise error unless on_error | ||
|
||
on_error.call(job, resource:, error:) |
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.
This syntax is not available in Rubies pre-3.1
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.
thanks for the fast feedback :) will change.
You've been fast, in the meantime i've changed the naming a bit and added support for a global config
eeb46cb
to
19cbeb6
Compare
7b1bf6a
to
805bd1c
Compare
805bd1c
to
97de8fa
Compare
I've been running this PR in production for some days now. Most of the errors that we encounter come from |
Think we've also been encountering this issue after doing an upgrade with a job with the unique config of; Is the gem going to include these changes in the near future? |
I think we are experiencing a similar issue related to the @sharshenov are we able to merge or get an official fix? |
Hey, yes I am still running the branch. Since we never experienced any real issues I suspect this arrises through a raise condition and the lock already being deleted but I did not investigate it further |
There have been some changes to the behaviour of
redis-client
andredlock-rb
which lead to a different behaviour in this gem.Before leandromoreira/redlock-rb#110 was merged, redlock would return
false
if there was an error with the connection, now it raises the error.Before this behaviour could have been handled by configuring
on_conflict
. Now the behaviour should be more fine grained.This adds a
on_error
option, which can be eithernil
(leading to a reraise) or aproc
leading to the evaluation of said proc.This allows users to handle connections errors to reduce the amount of jobs that get lost because of said connection errors.