This commit is contained in:
as2252258@163.com
2021-04-24 00:21:18 +08:00
parent 2862a15121
commit 40d55fa3fa
2 changed files with 19 additions and 19 deletions
+1 -19
View File
@@ -177,24 +177,6 @@ abstract class Crontab extends BaseObject
}
/**
* @throws Exception
*/
private function recover(): bool
{
$redis = Snowflake::app()->getRedis();
if ($redis->exists('stop:crontab:' . $this->getName())) {
$redis->del('crontab:' . $this->getName());
$redis->del('stop:crontab:' . $this->getName());
} else {
$redis->set('crontab:' . ($name = $this->getName()), static::getSerialize($this));
$tickTime = time() + $this->getTickTime();
$redis->zAdd(Producer::CRONTAB_KEY, $tickTime, $name);
}
return true;
}
abstract public function process(): mixed;
abstract public function max_execute(): mixed;
@@ -233,7 +215,7 @@ abstract class Crontab extends BaseObject
call_user_func([$this, 'max_execute'], ...$this->getParams());
return $redis->del('crontab:' . $this->getName());
} else {
return $this->recover();
return 999;
}
} catch (\Throwable $throwable) {
return logger()->addError($throwable, 'throwable');