* Only restartCron when scheduler init.

This commit is contained in:
zhujinyong
2023-11-17 13:20:52 +08:00
parent a56b8e49f3
commit 8f6df926ca
+4 -5
View File
@@ -166,20 +166,21 @@ class cron extends control
/**
* Schedule cron task by RoadRunner.
*
* @param bool $restart
* @access public
* @return void
*/
public function rrSchedule($restart = true)
public function rrSchedule()
{
if('cli' !== PHP_SAPI) return;
set_time_limit(0);
session_write_close();
$execId = mt_rand();
$this->cron->restartCron($execId);
$this->loadModel('common');
$execId = mt_rand();
while(true)
{
if(empty($this->config->global->cron))
@@ -188,8 +189,6 @@ class cron extends control
continue;
}
if($restart) $this->cron->restartCron($execId);
if($this->canSchedule($execId)) $this->schedule($execId);
sleep(20);