modify
This commit is contained in:
@@ -63,6 +63,7 @@ class Crontab extends Component
|
|||||||
foreach ($data as $datum) {
|
foreach ($data as $datum) {
|
||||||
$redis->del('crontab:' . md5($datum));
|
$redis->del('crontab:' . md5($datum));
|
||||||
}
|
}
|
||||||
|
$redis->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
namespace Snowflake\Process;
|
namespace Snowflake\Process;
|
||||||
|
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Snowflake\Crontab;
|
use Snowflake\Crontab;
|
||||||
use Snowflake\Abstracts\Crontab as ACrontab;
|
use Snowflake\Abstracts\Crontab as ACrontab;
|
||||||
use Snowflake\Event;
|
use Snowflake\Event;
|
||||||
@@ -38,9 +39,8 @@ class CrontabProcess extends Process
|
|||||||
*/
|
*/
|
||||||
public function onHandler(\Swoole\Process $process): void
|
public function onHandler(\Swoole\Process $process): void
|
||||||
{
|
{
|
||||||
$redis = Snowflake::app()->getRedis();
|
$crontab = Snowflake::app()->get('crontab');
|
||||||
$redis->del(ACrontab::CRONTAB_KEY);
|
$crontab->clearAll();
|
||||||
$redis->release();
|
|
||||||
|
|
||||||
Timer::tick(1000, function () {
|
Timer::tick(1000, function () {
|
||||||
$startTime = time();
|
$startTime = time();
|
||||||
@@ -51,6 +51,7 @@ class CrontabProcess extends Process
|
|||||||
$redis->zRemRangeByScore(ACrontab::CRONTAB_KEY, '0', (string)$startTime);
|
$redis->zRemRangeByScore(ACrontab::CRONTAB_KEY, '0', (string)$startTime);
|
||||||
foreach ($range as $value) {
|
foreach ($range as $value) {
|
||||||
$crontab = $redis->get('crontab:' . md5($value));
|
$crontab = $redis->get('crontab:' . md5($value));
|
||||||
|
$redis->del('crontab:' . md5($value));
|
||||||
if (empty($crontab) || !($crontab = unserialize($crontab))) {
|
if (empty($crontab) || !($crontab = unserialize($crontab))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user