[9.x] Make sure the lock_connection is used for schedule's withoutOverlapping() #45963
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.
Background
PR #35621 added a separate
lock_connection
so that locks would not be cleared whencache: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 implementsLockProvider
and that a separatelock_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 implementLockProvider
(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 implementsLockProvider
).