10000 [Lock] Remove "Lock" from the container · Issue #38458 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Lock] Remove "Lock" from the container #38458
Closed
@lyrixx

Description

@lyrixx

I notice I have the following service in my application (I cleaned the list):

bin/console  debug:container | grep -i lock
  Symfony\Component\Lock\LockInterface                                    alias for "lock.default"
  lock                                                                    alias for "lock.default"
  lock.default                                                            Symfony\Component\Lock\Lock

IMHO, it does not make sens to propose this "default" lock in the DIC. I added the dumped XML configuration of my DIC to better understand.

With this service, symfony will always returns the same lock, I mean on the same resource.
Usually, we use a different resource each time. like resource = project:id:action or something similar.

Don't get me wrong, I suggest to remove the Lock from the DIC but to keep the LockFactory.

So we should depreated then remove the Lock, in favor of the LockFactory.

    <service id="lock.default.factory" class="Symfony\Component\Lock\LockFactory" public="false">
      <argument type="service" id=".lock.default.store.VkIJQtB"/>
      <call method="setLogger">
        <argument type="service" id="monolog.logger.lock" on-invalid="ignore"/>
      </call>
    </service>

    <service id="lock.default" class="Symfony\Component\Lock\Lock" public="false">
      <argument>default</argument>
      <factory service="lock.default.factory" method="createLock"/>
    </service>

WDYT?

/cc @jderusse

Metadata

Metadata

Assignees

No one assigned

    Labels

    LockRFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0