From cd4aea75cf7faf9f5419ab5e1b0f7b654f7fbe0f Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Wed, 21 May 2025 15:40:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/application/job/WorkbenchJob.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Server/application/job/WorkbenchJob.php b/Server/application/job/WorkbenchJob.php index 01f06dd8..06096be5 100644 --- a/Server/application/job/WorkbenchJob.php +++ b/Server/application/job/WorkbenchJob.php @@ -196,8 +196,8 @@ class WorkbenchJob return; } - // 将好友列表分成20组 - $friendGroups = array_chunk($friendList, 20); + // 将好友列表分成10组 + $friendGroups = array_chunk($friendList, 10); $processes = []; foreach ($friendGroups as $groupIndex => $friendGroup) { @@ -214,6 +214,10 @@ class WorkbenchJob } else { // 子进程 try { + // 重置数据库连接 + Db::close(); + Db::init(); + foreach ($friendGroup as $friend) { // 验证是否达到点赞次数上限 $likeCount = $this->getTodayLikeCount($workbench, $config, $friend['deviceId']); @@ -234,6 +238,9 @@ class WorkbenchJob } } catch (\Exception $e) { Log::error("工作台 {$workbench->id} 子进程异常: " . $e->getMessage()); + } finally { + // 确保关闭数据库连接 + Db::close(); } // 子进程执行完毕后退出