modify
This commit is contained in:
@@ -32,11 +32,8 @@ class Producer extends Component
|
||||
throw new Exception('Cache key ' . self::CRONTAB_KEY . ' types error.');
|
||||
}
|
||||
|
||||
$redis->setex('stop:crontab:' . $name, 120, 1);
|
||||
$redis->del('crontab:' . $name);
|
||||
$redis->zRem(static::CRONTAB_KEY, $name);
|
||||
if ($redis->exists('crontab:' . $name)) {
|
||||
$redis->del('crontab:' . $name);
|
||||
}
|
||||
|
||||
$redis->zAdd(self::CRONTAB_KEY, time() + $crontab->getTickTime(), $name);
|
||||
$redis->set('crontab:' . $name, swoole_serialize($crontab));
|
||||
|
||||
@@ -64,7 +64,10 @@ class Zookeeper extends Process
|
||||
{
|
||||
try {
|
||||
$params['action'] = 'crontab';
|
||||
$params['handler'] = swoole_unserialize($redis->get('crontab:' . $value));
|
||||
if (($handler = $redis->exists('crontab:' . $value)) === false) {
|
||||
return;
|
||||
}
|
||||
$params['handler'] = swoole_unserialize($handler);
|
||||
|
||||
$result = $server->sendMessage($params, $workerId = random_int(0, $setting - 1));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user