From 4d452e3909152833653d5d5ebf7188c45eddc46f Mon Sep 17 00:00:00 2001 From: "iyuu.cn" <367013672@qq.com> Date: Thu, 20 Feb 2020 18:09:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=A7=E4=BA=8E=E4=B8=80?= =?UTF-8?q?=E4=B8=87=E6=9D=A1=E5=81=9A=E7=A7=8D=EF=BC=8C=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E7=B2=BE=E7=AE=80=E9=85=8D=E7=BD=AE=EF=BC=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E8=AE=BE=E7=BD=AE=E6=97=A0=E6=95=88=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/AutoReseed.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/AutoReseed.php b/app/AutoReseed.php index 2547890..5c8b18f 100644 --- a/app/AutoReseed.php +++ b/app/AutoReseed.php @@ -286,9 +286,11 @@ class AutoReseed wlog($hashArray, 'hashString'.$k); self::$wechatMsg['hashCount'] +=count($infohash_Dir); // 此处优化大于一万条做种时,设置超时 - if(self::$wechatMsg['hashCount'] > 5000){ - self::$curl->setOpt(CURLOPT_CONNECTTIMEOUT,$configALL['default']['CONNECTTIMEOUT']); - self::$curl->setOpt(CURLOPT_TIMEOUT,$configALL['default']['TIMEOUT']); + if(count($infohash_Dir) > 5000){ + $connecttimeout = isset($configALL['default']['CONNECTTIMEOUT']) && $configALL['default']['CONNECTTIMEOUT']>60 ? $configALL['default']['CONNECTTIMEOUT'] : 60; + $timeout = isset($configALL['default']['TIMEOUT']) && $configALL['default']['TIMEOUT']>600 ? $configALL['default']['TIMEOUT'] : 600; + self::$curl->setOpt(CURLOPT_CONNECTTIMEOUT,$connecttimeout); + self::$curl->setOpt(CURLOPT_TIMEOUT,$timeout); } echo "正在向服务器提交 clients_".$k." 种子哈希……".PHP_EOL; $res = self::$curl->post(self::$apiUrl . self::$endpoints['infohash'], $hashArray);