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.

CommentFileSizeAuthor
#1 improve-lock-release-all-1966614-1.patch928 bytesBerdir
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Status: Active » Needs review
FileSize
928 bytes

This 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.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Is there an issue which injects the db connection into the lock object? If we do that, it would be certainly better to test.

Berdir’s picture

I 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 :)

catch’s picture

Status: Reviewed & tested by the community » Fixed

That's full of nasty, but the fix looks fine to me. Committed/pushed to 8.x.

Automatically closed -- issue fixed for 2 weeks with no activity.