stanley-king před 3 roky
rodič
revize
c339b15283

+ 4 - 0
helper/refill/policy/chctl.php

@@ -154,13 +154,17 @@ class chctl
                 return $lover < $rover ? -1 : 1;
             }
         };
+
+        Log::record("match usort 1",Log::DEBUG);
         usort($usable_items, $ascending);
+        Log::record("match usort 2",Log::DEBUG);
 
         $result = [];
         foreach ($usable_items as $item) {
             $name = $item->name();
             $result[$name] = $item->speed_overload();
         }
+        Log::record("match usort 3",Log::DEBUG);
 
         return $result;
     }

+ 1 - 1
helper/refill/policy/ctl_item.php

@@ -86,7 +86,7 @@ class ctl_item
     {
         $this->load($this->mLastReadTime);
         $speed = array_sum($this->mRecords);
-        Log::record("{$this->mPrefix} speed = {$speed} max_speed={$this->mMaxSpeed}", Log::DEBUG);
+        Log::record("{$this->mPrefix} speed={$speed} max_speed={$this->mMaxSpeed}", Log::DEBUG);
 
         return $speed;
     }

+ 1 - 1
helper/refill/policy/quaility.php

@@ -184,7 +184,7 @@ class Quality
             }
         }
 
-        Log::record("calc_quality begin qualities= " . implode(',',$qualities),Log::DEBUG);
+        Log::record("calc_phone_quality begin qualities= " . implode(',',$qualities),Log::DEBUG);
         $times_checker = function($qualities, $times)
         {
             $result = [];

+ 3 - 0
helper/refill/policy/xyz/policy.php

@@ -214,7 +214,10 @@ class policy extends ProviderManager implements IPolicy
             if(empty($providers)) continue;
 
             $names = $namer($providers);
+
+            Log::record("find_quality match 1",Log::DEBUG);
             $names_overload = $this->mChannelControl->match($names, $spec, $card_type, $quality);
+            Log::record("find_quality match 2",Log::DEBUG);
 
             if (!empty($names_overload)) {
                 return [$org_quality, $quality];

+ 18 - 1
rdispatcher/coall.php

@@ -163,8 +163,25 @@ for ($i = 0; $i < $process_count;$i++)
 Log::record("main process start wait sub process....",Log::DEBUG);
 while (true)
 {
-    if($status = Swoole\Process::wait(true)) {
+    if($status = Swoole\Process::wait(true))
+    {
+        $quit_pid = $status['pid'];
         Log::record("Sub process #{$status['pid']} quit, code={$status['code']}, signal={$status['signal']}",Log::DEBUG);
+        foreach ($workers as $pid => $worker)
+        {
+            if($pid != $quit_pid) {
+                Swoole\Process::kill($pid, SIGTERM);
+            }
+        }
+
+        foreach ($workers as $pid => $worker)
+        {
+            if($pid != $quit_pid && ($status = Swoole\Process::wait(true)))
+            {
+                Log::record("Graceful Recycled #{$status['pid']}, code={$status['code']}, signal={$status['signal']}",Log::DEBUG);
+            }
+        }
+        break;
     }
     else
     {