Skip to content

Commit aa5d700

Browse files
Merge branch '3.4'
* 3.4: [Yaml] Recommend using quotes instead of PARSE_KEYS_AS_STRINGS [DependencyInjection] Deprecate autowiring service auto-registration Removed useless argument $definition [DI] Generate shorter method names for class-based ids Fix comment [Config] Fix checking class existence freshness bumped Symfony version to 3.3.7 updated VERSION for 3.3.6 updated CHANGELOG for 3.3.6 Autoconfigure instances of ArgumentValueResolverInterface Deprecate Filesystem/LockHandler improve sql explain table display Bump minimal PHP version to ^5.5.9|>=7.0.8
2 parents 20f5213 + 5372b4d commit aa5d700

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

Store/SemaphoreStore.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,24 @@
2424
*/
2525
class SemaphoreStore implements StoreInterface
2626
{
27-
public static function isSupported()
27+
/**
28+
* Returns whether or not the store is supported.
29+
*
30+
* @param bool|null $blocking When not null, checked again the blocking mode.
31+
*
32+
* @return bool
33+
*/
34+
public static function isSupported($blocking = null)
2835
{
29-
return extension_loaded('sysvsem');
36+
if (!extension_loaded('sysvsem')) {
37+
return false;
38+
}
39+
40+
if ($blocking === false && \PHP_VERSION_ID < 50601) {
41+
return false;
42+
}
43+
44+
return true;
3045
}
3146

3247
public function __construct()

Tests/Store/BlockingStoreTestTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ abstract protected function getStore();
3535
public function testBlockingLocks()
3636
{
3737
// Amount a microsecond used to order async actions
38-
$clockDelay = 50000;
38+
$clockDelay = 200000;
3939

4040
/** @var StoreInterface $store */
4141
$store = $this->getStore();
4242
$key = new Key(uniqid(__METHOD__, true));
4343

4444
if ($childPID1 = pcntl_fork()) {
4545
// give time to fork to start
46-
usleep(2 * $clockDelay);
46+
usleep(1 * $clockDelay);
4747

4848
try {
4949
// This call should failed given the lock should already by acquired by the child #1
@@ -63,8 +63,8 @@ public function testBlockingLocks()
6363
} else {
6464
try {
6565
$store->save($key);
66-
// Wait 3 ClockDelay to let parent process to finish
67-
usleep(3 * $clockDelay);
66+
// Wait 2 ClockDelay to let parent process to finish
67+
usleep(2 * $clockDelay);
6868
$store->delete($key);
6969
exit(0);
7070
} catch (\Exception $e) {

0 commit comments

Comments
 (0)