Skip to content

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

2 participants