redis调整
This commit is contained in:
@@ -161,6 +161,14 @@ LUA;
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$redis = $this->connect();
|
$redis = $this->connect();
|
||||||
|
//判断是否执行
|
||||||
|
$sStatus = $redis->hGet($key, 'status');
|
||||||
|
if (!empty($sStatus) && $sStatus == 'completed') {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if (!empty($sStatus) && $sStatus == 'processing') {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
$redis->hMSet($key, [
|
$redis->hMSet($key, [
|
||||||
'status' => 'processing',
|
'status' => 'processing',
|
||||||
'total' => $totalQuestions,
|
'total' => $totalQuestions,
|
||||||
@@ -168,9 +176,9 @@ LUA;
|
|||||||
'start_time' => time()
|
'start_time' => time()
|
||||||
]);
|
]);
|
||||||
$redis->expire($key, 10800); // 6小时过期
|
$redis->expire($key, 10800); // 6小时过期
|
||||||
return true;
|
return 1;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return false;
|
return 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 多问题按条件拆分成两个队列新增日志记录
|
// 多问题按条件拆分成两个队列新增日志记录
|
||||||
|
|||||||
Reference in New Issue
Block a user