Problem/Motivation
As discussed in #3228623: DX: Creating lazy services is too difficult/obscure/bespoke/brittle the DX for our current lazy service proxies is poor. We tried using symfony lazy services in #3396928: Deprecate Drupal ProxyBuilder in favor of Symfony lazy services however that was not possible due to:
Sadly SF uses eval for the proxy classes which at least I can't see working with our serialized container solution
However we can now use service closures to lazy-load services which are supported by our serialized container.
This is the issue to do this for the lock services.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3613241
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3613241-remove-lazy-lock
changes, plain diff MR !16442
Comments
Comment #3
longwaveLock instantiation shouldn't be expensive as the database is likely already initialised, I think.
The constructor also calls:
but this is a no-op if no locks were acquired. We could move this into the
acquire()method but it's probably not worth it.Comment #4
smustgrave commentedThink this needs a CR?
Comment #5
longwaveI don't think so, this is just an internal flag for the container, while there are code changes this should have no effect on the way the service actually works.
Comment #6
smustgrave commentedFair enough looks fine to me
Comment #9
catchCommitted/pushed to main and 11.x, thanks!