Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Lock] Add$prefix
parameter to avoid collision withFlockStore
#57857
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:7.4
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
$prefix
parameter to avoid collision withFlockStore
7.2 | ||
--- | ||
* Add parameter `$prefix` to `FlockStore::__construct()` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
* Addparameter`$prefix` to`FlockStore::__construct()` | |
* Add`$prefix` parameter to`FlockStore::__construct()` |
* | ||
* @throws LockStorageException If the lock directory doesn’t exist or is not writable | ||
*/ | ||
public function __construct(?string $lockPath = null) | ||
public function __construct(?string $lockPath = null, ?string $prefix = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
publicfunction __construct(?string$lockPath =null, ?string$prefix =null) | |
publicfunction __construct( | |
?string$lockPath =null, | |
private ?string$prefix =null, | |
) |
We can use CPP (constructor property promotion here)
Didn't the |
It does. But by default, everything is written in the temp directory and if two Symfony projects use the default configuration they will share the lock. The purpose of this PR is to provide a way to insulate by default the lock per Symfony instance (using the |
What about this PR ? The idea is to allow multiple Symfony project to use |
I would do it diffently: since by default we have a shared lock space, we should still do that, or we might break apps. |
Uh oh!
There was an error while loading.Please reload this page.
Currently if two Symfony projects are hosted on the same server and used the same key for a lock using the default
FlockStore
, the two applications shared the same lock.So I suggest adding a prefix in the
FlockStore
constructor to isolate the lock to the current project and avoid collision.This prefix could be initialized with the
kernel.secret
parameter by default.To avoid BC, I add the
flock-exclusive
lock key configuration.I know this could be done by changing the path a the
FlockStore
, but this "exclusive lock" could be the default behaviour of Symfony in the next major release.