Browse Source

add coroutine quit

stanley-king 3 years ago
parent
commit
e3062d78a1
1 changed files with 8 additions and 0 deletions
  1. 8 0
      helper/queue/iqueue.php

+ 8 - 0
helper/queue/iqueue.php

@@ -295,6 +295,14 @@ abstract class ILooper
                 $pcid = Swoole\Coroutine::getPcid($cid);
                 if($pcid == $this->_cid) {
                     $count += 1;
+                    $time_secs = Swoole\Coroutine::getElapsed([$cid]);
+                    $backtrace = Swoole\Coroutine::getBackTrace($cid);
+
+                    $trace = "wait Coroutine quit tim={$time_secs}\n";
+                    foreach ($backtrace as $item) {
+                        $trace .= "{$item['file']}\t{$item['line']}\t{$item['function']}\n";
+                    }
+                    Log::record($trace,Log::DEBUG);
                 }
             }