Closed
Description
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