Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[RFC] [Console] [Lock] Locking a command on multiple servers #35535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
noniagriconomie opened this issue Jan 31, 2020 · 4 comments
Closed

[RFC] [Console] [Lock] Locking a command on multiple servers #35535

noniagriconomie opened this issue Jan 31, 2020 · 4 comments

Comments

@noniagriconomie
Copy link
Contributor

Description

Hi,

RFC issue related to https://symfony.com/doc/master/console/lockable_trait.html, and the sentence the same command in a single server

I want to know if this console lock feature can be extended/improved to have a multiple server feature?

Using for example pdo lock or redis one.

Thank you,

@stof
Copy link
Member

stof commented Jan 31, 2020

Well, use the Lock component directly for that. It is able to do that. But locks shared between servers require a shared storage (a Redis server for instance), so this cannot be implemented in the LockableTrait which hides the details of using the Lock component.

@noniagriconomie
Copy link
Contributor Author

@stof thx for the fast answer :)

yes my request was mainly to put the pdo lock in this trait, inside the symfony core
99% of the project do have a database

to avoid relying on a devland implementation
wdyt, is it reasonable?

@stof
Copy link
Member

stof commented Jan 31, 2020

We cannot put the PDO lock in the trait.
The trait instantiates the lock store and the lock factory internally to hide the usage of the lock component in an easy-to-use API for commands. But that means it can only use stores which require no dependency.

As soon as you want to use a lock factory injected through dependency injection (to be able to use the pdo store configured by FrameworkBundle), the trait is useless. All the remaining logic is already encapsulated in the lock component itself: https://symfony.com/doc/master/components/lock.html#usage

And making the trait itself support injecting a factory inside it would make it more complex.

@noniagriconomie
Copy link
Contributor Author

@stof ok i see your point now, I will duplicate such trait to my devland code then and leveraging the pdo lock feature instead

thank you again for your time

(closed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants