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

Command icon 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:

Comments

longwave created an issue. See original summary.

longwave’s picture

Status: Active » Needs review

Lock instantiation shouldn't be expensive as the database is likely already initialised, I think.

The constructor also calls:

    drupal_register_shutdown_function([$this, 'releaseAll']);

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.

smustgrave’s picture

Think this needs a CR?

longwave’s picture

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

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Fair enough looks fine to me

  • catch committed ef237d60 on 11.x
    task: #3613241 Remove lazy declaration and proxy class for lock services...

  • catch committed 41844eb9 on main
    task: #3613241 Remove lazy declaration and proxy class for lock services...
catch’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to main and 11.x, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.