|
@@ -94,20 +94,18 @@ function subscribe_message(&$quit, &$redis, $channels,$looper)
|
|
|
}
|
|
|
elseif($type == 'ratio')
|
|
|
{
|
|
|
-// if($fLoading == false)
|
|
|
-// {
|
|
|
-// $ins = Cache::getInstance('cacheredis');
|
|
|
-// $val = $ins->get_org('channel_ratios');
|
|
|
-//
|
|
|
-// if(empty($val)) return;
|
|
|
-// $val = json_decode($val,true);
|
|
|
-// if(empty($val)) return;
|
|
|
-// $ratios = $val['ratios'];
|
|
|
-// if(empty($ratios)) return;
|
|
|
-//
|
|
|
-//// refill\RefillFactory::instance()->UpdateRatio($ratios);
|
|
|
-//
|
|
|
-// }
|
|
|
+ if($fLoading == false)
|
|
|
+ {
|
|
|
+ $ins = Cache::getInstance('cacheredis');
|
|
|
+ $val = $ins->get_org('channel_ratios');
|
|
|
+
|
|
|
+ if(empty($val)) return;
|
|
|
+ $val = json_decode($val,true);
|
|
|
+ if(empty($val)) return;
|
|
|
+ $ratios = $val['ratios'];
|
|
|
+ if(empty($ratios)) return;
|
|
|
+ refill\RefillFactory::instance()->UpdateRatio($ratios);
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
Log::record("subscribe_message dont not handle mgs:{$channel}-{$type}",Log::DEBUG);
|
|
@@ -133,12 +131,20 @@ for ($i = 0; $i < $process_count;$i++)
|
|
|
Log::record("Swoole::Process init",Log::DEBUG);
|
|
|
Base::run_util();
|
|
|
refill\RefillFactory::instance();
|
|
|
- set_error_handler('handle_error');
|
|
|
Log::record("Swoole::Process init success",Log::DEBUG);
|
|
|
|
|
|
$sub_quit = false;
|
|
|
$sub_redis = null;
|
|
|
$looper = new processor(false);
|
|
|
+ register_shutdown_function(function () use ($looper)
|
|
|
+ {
|
|
|
+ $error = error_get_last();
|
|
|
+ if(!empty($error)) {
|
|
|
+ $msg = "register_shutdown_function type:{$error['type']}\n message:{$error['message']}\n file={$error['file']} line={$error['line']}";
|
|
|
+ Log::record("$msg",Log::ERR);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ set_error_handler('handle_error');
|
|
|
|
|
|
go(function () use (&$sub_quit,&$sub_redis,$looper) {
|
|
|
subscribe_message($sub_quit,$sub_redis,['refill'],$looper);
|
|
@@ -150,7 +156,7 @@ for ($i = 0; $i < $process_count;$i++)
|
|
|
|
|
|
Swoole\Process::signal(SIGTERM, function($signal_num) use ($worker,&$sub_quit,$sub_redis,$looper)
|
|
|
{
|
|
|
- Log::record("signal call SIGTERM begin = $signal_num, #{$worker->pid}",Log::DEBUG);
|
|
|
+ Log::record("signal call SIGTERM begin signum={$signal_num}, pid={$worker->pid}",Log::DEBUG);
|
|
|
|
|
|
set_error_handler(null);
|
|
|
try {
|