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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure batch delete removes expiring locks #724

Merged

Conversation

francesmcmullin
Copy link
Contributor

Hi @mhenrixon thanks so much for the positive response to #721

Unfortunately I missed a spot! 馃槄 In truth, I think it's unnecessary to use batch delete when removing expiring locks - it would be enough to just remove the digests from the ZSET because all other elements are expired by redis, but since I did use batch delete - it's really important that batch delete removes from this new ZSET!

Previously, I only updated lock.lua to put these digests into a separate ZSET because that's what the locksmith calls, but when trying to verify this fix in tests, I found lock.rb needed to be updated as well, so that's here too.

@francesmcmullin francesmcmullin force-pushed the bug/del-from-expiring-zset branch 3 times, most recently from 6c70fa2 to 455a68c Compare July 1, 2022 14:28

it "clears the lock" do
expect(redis { |conn| conn.zcard(SidekiqUniqueJobs::EXPIRING_DIGESTS) }).to eq 1
sleep 2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This spec passes for me locally, but I don't think a sleep this long is really appropriate even if it did work consistently. It's also not really the right place for a spec which is curious about the interaction between both the reaper and batch delete. It's here to demonstrate the issue, but I'd love your thoughts about a better location or tactic for testing this

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A sleep of two seconds would increase the test suite time with more than 50% (on my machine). Seems like something else is off here, I am without a computer until Monday but I'll check then.

@fotinakis
Copy link

Hey friends, what's the status on this PR? I hear this will help solve our rollout issues with using :until_expired at heavy scale (#637 (comment)).

I'd be happy to run against this branch for a large-scale test if that'd be helpful, once it's ready and tests passing.

@mhenrixon mhenrixon merged commit 6c7d48d into mhenrixon:main Jul 12, 2022
@francesmcmullin francesmcmullin deleted the bug/del-from-expiring-zset branch July 12, 2022 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants