modify
This commit is contained in:
@@ -39,10 +39,22 @@ class Consumer extends Process
|
||||
go(function () {
|
||||
$this->popChannel();
|
||||
});
|
||||
|
||||
$this->recovery();
|
||||
$this->tick($process);
|
||||
}
|
||||
|
||||
|
||||
private function recovery()
|
||||
{
|
||||
$redis = redis()->hGetAll('crontab:wait:execute');
|
||||
foreach ($redis as $redi) {
|
||||
$this->channel->push($redi);
|
||||
}
|
||||
fire(Event::SYSTEM_RESOURCE_RELEASES);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -82,7 +94,9 @@ class Consumer extends Process
|
||||
|
||||
$redis = Snowflake::app()->getRedis();
|
||||
|
||||
/** @var Crontab $crontab */
|
||||
$crontab = swoole_unserialize($redis->get($value));
|
||||
$redis->hSet('crontab:wait:execute', $crontab->getName(), $redis->get($value));
|
||||
$redis->del($value);
|
||||
if (is_object($crontab)) {
|
||||
$this->channel->push($crontab);
|
||||
|
||||
@@ -200,6 +200,7 @@ class Crontab extends BaseObject
|
||||
public function execute(): void
|
||||
{
|
||||
$params = call_user_func($this->handler, $this->params, $this->name);
|
||||
\redis()->hDel('crontab:wait:execute', $this->getName());
|
||||
if ($params !== null) {
|
||||
$name = date('Y_m_d_H_i_s.' . $this->name . '.log');
|
||||
write(storage($name, '/log/crontab'), serialize($params));
|
||||
|
||||
@@ -65,6 +65,7 @@ class ZookeeperProcess extends Process
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user