Skip to content
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

Explicitly unscope queries within block yielded to Lockable.within_advisory_lock #429

Merged
merged 1 commit into from
Oct 19, 2021

Conversation

bensheldon
Copy link
Owner

@bensheldon bensheldon commented Oct 19, 2021

TIL yield within an ActiveRecord class method will leak query scope into queries on the same model class within the block.

Discovered because the demo CleanupJob was not working correctly because its queries for GoodJob::Execution were being improperly scoped.

@bensheldon bensheldon temporarily deployed to goodjob-unscope-with-ad-raa4sh October 19, 2021 03:20 Inactive
@bensheldon bensheldon temporarily deployed to goodjob-unscope-with-ad-raa4sh October 19, 2021 04:07 Inactive
@bensheldon bensheldon added the refactor Code changes that do not introduce new features label Oct 19, 2021
@bensheldon bensheldon temporarily deployed to goodjob-unscope-with-ad-raa4sh October 19, 2021 04:28 Inactive
@bensheldon bensheldon added bug Something isn't working and removed refactor Code changes that do not introduce new features labels Oct 19, 2021
@bensheldon bensheldon merged commit 0c2a96a into main Oct 19, 2021
@bensheldon bensheldon deleted the unscope_with_advisory_lock branch October 19, 2021 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant