stanley-king 4 năm trước cách đây
mục cha
commit
b1936213fd
2 tập tin đã thay đổi với 34 bổ sung35 xóa
  1. 1 2
      helper/queue/iqueue.php
  2. 33 33
      rdispatcher/codispatcher.php

+ 1 - 2
helper/queue/iqueue.php

@@ -213,8 +213,7 @@ abstract class ILooper
                         if(empty($content)) continue;
 
                         go(function ()use ($content) {
-                            //$this->handle($content);
-                            Log::record(json_encode($content),Log::DEBUG);
+                            $this->handle($content);
                         });
                     }
                     else {

+ 33 - 33
rdispatcher/codispatcher.php

@@ -90,37 +90,37 @@ function sub_message($channels)
     }
 }
 
-Co\run(function()
-{
-    Base::run_util();
-    set_error_handler('handle_error');
-    go(function () {
-        sub_message(['refill']);
-    });
-    $looper = new processor(true);
-    $looper->run();
-});
-
-//for ($i = 0; $i < $process_count;$i++)
-//{
-//    $process = new Swoole\Process(function(Swoole\Process $worker)
-//    {
-//        Base::run_util();
-//        set_error_handler('handle_error');
-//        go(function () {
-//            sub_message(['refill']);
-//        });
-//
-//        $looper = new processor(true);
-//        $looper->run();
-//
-//    }, false, false, true);
-//
-//    $process->start();
-//}
-//
-//for ($i = 0; $i < $process_count;$i++)
+//Co\run(function()
 //{
-//    $status = Swoole\Process::wait(true);
-//    Log::record("Recycled #{$status['pid']}, code={$status['code']}, signal={$status['signal']}",Log::DEBUG);
-//}
+//    Base::run_util();
+//    set_error_handler('handle_error');
+//    go(function () {
+//        sub_message(['refill']);
+//    });
+//    $looper = new processor(true);
+//    $looper->run();
+//});
+
+for ($i = 0; $i < $process_count;$i++)
+{
+    $process = new Swoole\Process(function(Swoole\Process $worker)
+    {
+        Base::run_util();
+        set_error_handler('handle_error');
+        go(function () {
+            sub_message(['refill']);
+        });
+
+        $looper = new processor(true);
+        $looper->run();
+
+    }, false, false, true);
+
+    $process->start();
+}
+
+for ($i = 0; $i < $process_count;$i++)
+{
+    $status = Swoole\Process::wait(true);
+    Log::record("Recycled #{$status['pid']}, code={$status['code']}, signal={$status['signal']}",Log::DEBUG);
+}