|
@@ -634,9 +634,18 @@ class Worker
|
|
|
if (\DIRECTORY_SEPARATOR !== '/') {
|
|
if (\DIRECTORY_SEPARATOR !== '/') {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- $fd = $fd ?: \fopen(static::$pidFile . '.lock', 'a+');
|
|
|
|
|
|
|
+ $lock_file = static::$pidFile . '.lock';
|
|
|
|
|
+ $fd = $fd ?: \fopen($lock_file, 'a+');
|
|
|
if ($fd) {
|
|
if ($fd) {
|
|
|
flock($fd, $flag);
|
|
flock($fd, $flag);
|
|
|
|
|
+ if ($flag === \LOCK_UN) {
|
|
|
|
|
+ fclose($fd);
|
|
|
|
|
+ $fd = null;
|
|
|
|
|
+ clearstatcache();
|
|
|
|
|
+ if (\is_file($lock_file)) {
|
|
|
|
|
+ unlink($lock_file);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|