From 759b50d2b0f4fd3955cb1bec4c4cb9b6890de24d Mon Sep 17 00:00:00 2001 From: Marvin Kuhl Date: Mon, 14 Mar 2022 08:53:06 +0100 Subject: [PATCH] makes timeToLive and autoRelease configurable * for example redis store as lock storage needs the autoRelease to be true --- Classes/Http/SessionLockRequestComponent.php | 14 +++++++++++++- Configuration/Settings.yaml | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Classes/Http/SessionLockRequestComponent.php b/Classes/Http/SessionLockRequestComponent.php index 6a76898..964e9e2 100644 --- a/Classes/Http/SessionLockRequestComponent.php +++ b/Classes/Http/SessionLockRequestComponent.php @@ -31,6 +31,18 @@ class SessionLockRequestComponent implements ComponentInterface */ 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 */ @@ -50,7 +62,7 @@ class SessionLockRequestComponent implements ComponentInterface 'session-' . $sessionIdentifier ); //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); diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml index b55eb19..e49711d 100644 --- a/Configuration/Settings.yaml +++ b/Configuration/Settings.yaml @@ -12,3 +12,5 @@ DigiComp: FlowSessionLock: lockStoreDir: '%FLOW_PATH_DATA%Temporary/Production/SessionLocks' readOnlyExpressions: [] + autoRelease: true + timeToLive: 300