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

[9.x] Make sure the lock_connection is used for schedule's withoutOverlapping() #45963

Merged
merged 3 commits into from
Feb 7, 2023
Merged

[9.x] Make sure the lock_connection is used for schedule's withoutOverlapping() #45963

merged 3 commits into from
Feb 7, 2023

Conversation

johanrosenson
Copy link
Contributor

@johanrosenson johanrosenson commented Feb 4, 2023

Background

PR #35621 added a separate lock_connection so that locks would not be cleared when cache:clear was run, but this improvement was never implemented for the withoutOverlapping() used for task scheduling.

This PR

This PR aims to remedy this, care have been taken to still support cache drivers that doesn't support locking, so the old behaviour is preserved as a fallback.

With this PR we will remove the risk of overlapping tasks whenever cache:clear is run, as long as the cache driver implements LockProvider and that a separate lock_connection is configured.

For users that either uses a cache driver that doesn't support locking, or haven't configured the lock_connection, the previous behaviour will be used.

Tests

I had to modify the current tests so that they would bypass this new logic and still test the old logic, i did this by mocking the return value of getStore() and return anything that didn't implement LockProvider (i chose \stdClass), this will make sure that the old tests tests the old/fallback behaviour.

I also added 5 new tests that tests the same scenarios as the old tests but instead tests the new logic, i used the ArrayStore for this (since it implements LockProvider).

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.

2 participants