makes timeToLive and autoRelease configurable

* for example redis store as lock storage needs the autoRelease to be true
This commit is contained in:
Marvin Kuhl 2022-03-14 08:53:06 +01:00
parent 42bd77abb4
commit 759b50d2b0
2 changed files with 15 additions and 1 deletions

View file

@ -31,6 +31,18 @@ class SessionLockRequestComponent implements ComponentInterface
*/ */
protected $lockFactory; protected $lockFactory;
/**
* @Flow\InjectConfiguration(package="DigiComp.FlowSessionLock", path="autoRelease")
* @var bool
*/
protected bool $autoRelease;
/**
* @Flow\InjectConfiguration(package="DigiComp.FlowSessionLock", path="timeToLive")
* @var int
*/
protected int $timeToLive;
/** /**
* @inheritDoc * @inheritDoc
*/ */
@ -50,7 +62,7 @@ class SessionLockRequestComponent implements ComponentInterface
'session-' . $sessionIdentifier 'session-' . $sessionIdentifier
); //TODO: sessionIdentifier might be wrong, probably it should probably be storage identifier ); //TODO: sessionIdentifier might be wrong, probably it should probably be storage identifier
$lock = $this->lockFactory->createLockFromKey($key, 300, false); $lock = $this->lockFactory->createLockFromKey($key, $this->timeToLive, $this->autoRelease);
$componentContext->setParameter(SessionLockRequestComponent::class, 'sessionLock', $lock); $componentContext->setParameter(SessionLockRequestComponent::class, 'sessionLock', $lock);

View file

@ -12,3 +12,5 @@ DigiComp:
FlowSessionLock: FlowSessionLock:
lockStoreDir: '%FLOW_PATH_DATA%Temporary/Production/SessionLocks' lockStoreDir: '%FLOW_PATH_DATA%Temporary/Production/SessionLocks'
readOnlyExpressions: [] readOnlyExpressions: []
autoRelease: true
timeToLive: 300