Compare commits
No commits in common. "da747f2af86890ba4eb2fa2104cb14095b808f3a" and "2e45f615f85e292e99e6e74bc55868bfbe1049c5" have entirely different histories.
da747f2af8
...
2e45f615f8
2 changed files with 3 additions and 20 deletions
|
@ -8,7 +8,6 @@ use Neos\Flow\Annotations as Flow;
|
||||||
use Neos\Flow\Http\Component\ComponentContext;
|
use Neos\Flow\Http\Component\ComponentContext;
|
||||||
use Neos\Flow\Http\Component\ComponentInterface;
|
use Neos\Flow\Http\Component\ComponentInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\Lock\Exception\LockAcquiringException;
|
|
||||||
use Symfony\Component\Lock\Key;
|
use Symfony\Component\Lock\Key;
|
||||||
use Symfony\Component\Lock\LockFactory;
|
use Symfony\Component\Lock\LockFactory;
|
||||||
|
|
||||||
|
@ -46,12 +45,6 @@ class SessionLockRequestComponent implements ComponentInterface
|
||||||
*/
|
*/
|
||||||
protected bool $autoRelease;
|
protected bool $autoRelease;
|
||||||
|
|
||||||
/**
|
|
||||||
* @Flow\InjectConfiguration(package="DigiComp.FlowSessionLock", path="secondsToWait")
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
protected int $secondsToWait;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
@ -71,17 +64,8 @@ class SessionLockRequestComponent implements ComponentInterface
|
||||||
|
|
||||||
$componentContext->setParameter(SessionLockRequestComponent::class, static::PARAMETER_NAME, $lock);
|
$componentContext->setParameter(SessionLockRequestComponent::class, static::PARAMETER_NAME, $lock);
|
||||||
|
|
||||||
$this->logger->debug('SessionLock: Try to get "' . $key . '"');
|
$this->logger->debug('SessionLock: Get ' . $key);
|
||||||
$timedOut = \time() + $this->secondsToWait;
|
$lock->acquire(true);
|
||||||
while (!$lock->acquire() || $timedOut <= \time()) {
|
$this->logger->debug('SessionLock: Acquired ' . $key);
|
||||||
\usleep(100000);
|
|
||||||
}
|
|
||||||
if (!$lock->isAcquired()) {
|
|
||||||
throw new LockAcquiringException(
|
|
||||||
'Could not acquire the lock for "' . $key . '" in ' . $this->secondsToWait . ' seconds.',
|
|
||||||
1652687960
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$this->logger->debug('SessionLock: Acquired "' . $key . '"');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ DigiComp:
|
||||||
lockStoreConnection: "flock://%FLOW_PATH_DATA%Temporary/Production/SessionLocks/"
|
lockStoreConnection: "flock://%FLOW_PATH_DATA%Temporary/Production/SessionLocks/"
|
||||||
timeToLive: 300.0
|
timeToLive: 300.0
|
||||||
autoRelease: true
|
autoRelease: true
|
||||||
secondsToWait: 30
|
|
||||||
readOnlyExpressions: {}
|
readOnlyExpressions: {}
|
||||||
|
|
||||||
Neos:
|
Neos:
|
||||||
|
|
Loading…
Add table
Reference in a new issue