Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Because the lock is now injected into some services and we add the cleanup as a shutdown function in __construct(), that means we execute DELETE FROM semaphore WHERE (value = :db_condition_placeholder_0) on every request.
We need to move this so that it's only added when we actually request a lock.
Comment | File | Size | Author |
---|---|---|---|
#1 | improve-lock-release-all-1966614-1.patch | 928 bytes | Berdir |
Comments
Comment #1
BerdirThis is one way to solve it. Only execute the query if any locks were acquired.
The alternative would be to conditionally register the shutdown function.
Comment #2
dawehnerIs there an issue which injects the db connection into the lock object? If we do that, it would be certainly better to test.
Comment #3
BerdirI don't think that there's such an issue, should be easy in this case as we directly register the implementation as a service and don't have any managers/factories that make things complicated :)
Comment #4
catchThat's full of nasty, but the fix looks fine to me. Committed/pushed to 8.x.