forked from laysense/laysite
Address LaySite 1.4.0 review findings
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Content;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
final class UpdateCheckInProgress extends RuntimeException
|
||||
{
|
||||
}
|
||||
@@ -33,9 +33,12 @@ final class Updates
|
||||
throw new RuntimeException('无法打开版本检查缓存。');
|
||||
}
|
||||
try {
|
||||
if (!flock($lock, LOCK_EX | LOCK_NB)) {
|
||||
if (!flock($lock, LOCK_EX | LOCK_NB, $wouldBlock)) {
|
||||
if (!$wouldBlock) {
|
||||
throw new RuntimeException('无法锁定版本检查缓存。');
|
||||
}
|
||||
if (!array_key_exists('latest', $record)) {
|
||||
throw new RuntimeException('版本检查正在进行,请稍后重试。');
|
||||
throw new UpdateCheckInProgress('版本检查正在进行,请稍后重试。');
|
||||
}
|
||||
} else {
|
||||
$record = self::cached($path);
|
||||
|
||||
Reference in New Issue
Block a user