-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Allow user to specify folder for flock #26923
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ | |
use Symfony\Component\Lock\Factory; | ||
use Symfony\Component\Lock\Lock; | ||
use Symfony\Component\Lock\LockInterface; | ||
use Symfony\Component\Lock\Store\FlockStore; | ||
use Symfony\Component\Lock\Store\StoreFactory; | ||
use Symfony\Component\Lock\StoreInterface; | ||
use Symfony\Component\Messenger\Handler\MessageHandlerInterface; | ||
|
@@ -1377,6 +1378,14 @@ private function registerLockConfiguration(array $config, ContainerBuilder $cont | |
case 'flock' === $storeDsn: | ||
$storeDefinition = new Reference('lock.store.flock'); | ||
break; | ||
case 0 === strpos($storeDsn, 'flock://'): | ||
$flockPath = substr($storeDsn, 8); | ||
|
||
$storeDefinitionId = '.lock.flock.store.'.$container->hash($storeDsn); | ||
$container->register($storeDefinitionId, FlockStore::class)->addArgument($flockPath); | ||
|
||
$storeDefinition = new Reference($storeDefinitionId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need the reference? I mean if I don't miss anything, we do not reuse it anyway, so something like this should work the same: $flockPath = substr($storeDsn, 8);
$storeDefinitionId = '.lock.flock.store.'.$container->hash($storeDsn);
$storeDefinition = $container->register($storeDefinitionId, FlockStore::class)->addArgument($flockPath); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same can be said for both 'flock' and 'semaphore' cases. But I'm not sure that this PR is correct place for such refactoring. Besides '$storeDefinitions' already contains 'Reference' objects so it would be not cool to add strings or non-Reference type |
||
break; | ||
case 'semaphore' === $storeDsn: | ||
$storeDefinition = new Reference('lock.store.semaphore'); | ||
break; | ||
|
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.
missing
use
statement for theFlockStore
classThere 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.
done