From e3ba5a29b7a3d760d850657003342bc3775ae601 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Mon, 12 Apr 2021 03:04:42 +0800 Subject: [PATCH] modify --- System/Crontab/Crontab.php | 4 ++-- System/Crontab/Producer.php | 4 ++-- System/Crontab/Zookeeper.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/System/Crontab/Crontab.php b/System/Crontab/Crontab.php index f47f8414..a6dd74cc 100644 --- a/System/Crontab/Crontab.php +++ b/System/Crontab/Crontab.php @@ -203,11 +203,11 @@ class Crontab extends BaseObject { $redis = Snowflake::app()->getRedis(); - $redis->set('crontab:' . md5($this->getName()), swoole_serialize($this)); + $redis->set('crontab:' . ($name = md5($this->getName())), swoole_serialize($this)); $tickTime = time() + $this->getTickTime(); - $redis->zAdd(Producer::CRONTAB_KEY, $tickTime, $this->getName()); + $redis->zAdd(Producer::CRONTAB_KEY, $tickTime, $name); } diff --git a/System/Crontab/Producer.php b/System/Crontab/Producer.php index 567d4748..f7d5ea6b 100644 --- a/System/Crontab/Producer.php +++ b/System/Crontab/Producer.php @@ -33,7 +33,7 @@ class Producer extends Component $tickTime = time() + $crontab->getTickTime(); - $redis->zAdd(self::CRONTAB_KEY, $tickTime, $crontab->getName()); + $redis->zAdd(self::CRONTAB_KEY, $tickTime, $name); } @@ -59,7 +59,7 @@ class Producer extends Component $data = $redis->zRange(self::CRONTAB_KEY, 0, -1); $redis->del(self::CRONTAB_KEY); foreach ($data as $datum) { - $redis->del('crontab:' . md5($datum)); + $redis->del('crontab:' . $datum); } $redis->release(); } diff --git a/System/Crontab/Zookeeper.php b/System/Crontab/Zookeeper.php index 55aa9480..d8811a7b 100644 --- a/System/Crontab/Zookeeper.php +++ b/System/Crontab/Zookeeper.php @@ -62,9 +62,9 @@ class Zookeeper extends Process private function dispatch($server, $redis, $setting, $value) { $server->sendMessage(swoole_serialize([ - 'action' => 'crontab', 'handler' => swoole_unserialize($redis->get('crontab:' . md5($value))) + 'action' => 'crontab', 'handler' => swoole_unserialize($redis->get('crontab:' . $value)) ]), random_int(0, $setting - 1)); - $redis->del('crontab:' . md5($value)); + $redis->del('crontab:' . $value); }