This commit is contained in:
2021-03-24 17:57:08 +08:00
parent 2610267aba
commit 6df0cb4003
11 changed files with 576 additions and 532 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ class Crontab extends Component
$name = md5($crontab->getName());
$redis->set('crontab:' . $name, serialize($crontab));
$redis->set('crontab:' . $name, swoole_serialize($crontab));
$tickTime = time() + $crontab->getTickTime();
+1 -1
View File
@@ -52,7 +52,7 @@ class Async extends Component
$randWorkerId = random_int(0, $server->setting['task_worker_num'] - 1);
$server->task(serialize($class), $randWorkerId);
$server->task(swoole_serialize($class), $randWorkerId);
}
}
+2 -2
View File
@@ -32,7 +32,7 @@ class File extends Component implements ICache
public function set($key, $val): string|int
{
if (is_array($val) || is_object($val)) {
$val = serialize($val);
$val = swoole_serialize($val);
}
$tmpFile = $this->getCacheKey($key);
if (!$this->exists($tmpFile)) {
@@ -128,7 +128,7 @@ class File extends Component implements ICache
return false;
}
$content = file_get_contents($tmpFile);
return unserialize($content);
return swoole_unserialize($content);
}
/**
+1 -1
View File
@@ -105,7 +105,7 @@ class Str
*/
public static function isSerialize($data, $callBack = null): bool
{
$false = !empty($data) && unserialize($data) !== false;
$false = !empty($data) && swoole_unserialize($data) !== false;
if ($false && is_callable($callBack, true)) {
return call_user_func($callBack, $data);
}
+2 -2
View File
@@ -58,7 +58,7 @@ class CrontabProcess extends Process
foreach ($range as $value) {
$crontab = $redis->get('crontab:' . md5($value));
$redis->del('crontab:' . md5($value));
if (empty($crontab) || !($crontab = unserialize($crontab))) {
if (empty($crontab) || !($crontab = swoole_unserialize($crontab))) {
continue;
}
Coroutine::create(function (Crontab $value, int $startTime) {
@@ -114,7 +114,7 @@ class CrontabProcess extends Process
$name = md5($crontab->getName());
$redis->set('crontab:' . $name, serialize($crontab));
$redis->set('crontab:' . $name, swoole_serialize($crontab));
$tickTime = time() + $crontab->getTickTime();
+1 -1
View File
@@ -316,7 +316,7 @@ class Snowflake
$class = static::createObject($class);
$class->setParams($params);
$server->task(serialize($class));
$server->task(swoole_serialize($class));
}