Pass item in after_unlock callback#665
Merged
mhenrixon merged 5 commits intomhenrixon:mainfrom Dec 2, 2021
Merged
Conversation
mhenrixon
reviewed
Dec 1, 2021
| lambda do | ||
| if @worker_class.respond_to?(:after_unlock) | ||
| @worker_class.after_unlock # instance method in sidekiq v6 | ||
| @worker_class.after_unlock(item) # instance method in sidekiq v6 |
Owner
There was a problem hiding this comment.
I love the suggestion, in this case we would likely have to check the arity of the method and only pass the item if the callback method responds to 1 method argument and warn if it does not.
This would otherwise crash for a lot of users if the method doesn't support an argument?
Contributor
Author
There was a problem hiding this comment.
You are right. I wasn't aware of the arity check possibility. I added it.
The PR is blocked on a code climate issue. Breaking up the method seems to add more complexity...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Suggestion to pass
iteminafter_unlockcallback.Loosely related to issue #664