改进 Edge

This commit is contained in:
iVampireSP.com 2023-02-28 20:48:03 +08:00
parent 35e707c01e
commit 2658591079
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
@ -8,24 +9,6 @@ $node_id = '{{NODE_ID}}';
$nginx_conf_path = '/path/to/api.laecloud.com.conf';
/** 自动生成的配置文件,如有变动,按照需求编辑。 **/
$redis_info = [
'host' => '{{REDIS_HOST}}',
@ -145,11 +128,9 @@ while (true) {
try {
if (!$redis->exists($prefix . 'cluster:nodes')) {
output('cluster:nodes not found');
exit;
}
} catch (RedisException $e) {
output('redis is error');
exit;
}
$nodes = redis_hgetAll('nodes');
@ -302,7 +283,7 @@ function redis_hset($key, $hash_key, $value)
try {
$redis->hset($prefix . 'cluster:' . $key, $hash_key, json_encode($value));
} catch (RedisException $e) {
exit('redis get error: '.$e->getMessage());
echo 'redis get error: ' . $e->getMessage();
}
}
@ -313,7 +294,7 @@ function redis_hdel($key, $hash_key): void
try {
$redis->hdel($prefix . 'cluster:' . $key, $hash_key);
} catch (RedisException $e) {
exit('redis get error: '.$e->getMessage());
echo 'redis get error: ' . $e->getMessage();
}
}
@ -335,6 +316,6 @@ function redis_publish($event, $message = []): void
try {
$redis->publish($prefix . 'cluster_ready', $data);
} catch (RedisException $e) {
exit('redis publish error: '.$e->getMessage());
echo 'redis publish error: ' . $e->getMessage();
}
}