Browse Source

debug co::sleep

stanley-king 3 years ago
parent
commit
c6d3ce7ac9
1 changed files with 19 additions and 16 deletions
  1. 19 16
      rdispatcher/codispatcher.php

+ 19 - 16
rdispatcher/codispatcher.php

@@ -106,22 +106,25 @@ function ratio_update(&$quit)
     while (!$quit)
     {
         Log::record("ratio_update start calc quit =" . strbool($quit),Log::DEBUG);
-
-        for ($i = 0; $i < 61; $i++) {
-            $cur_time = time();
-            $time_sec = $cur_time;
-            $next_min = $time_sec - $time_sec % 60;
-
-            if($quit) break;
-            if($next_min > $cur_min && $time_sec % 60 == 3) {
-                $cur_min = $next_min;
-                break;
-            } else {
-                Log::record("ratio_update start sleep",Log::DEBUG);
-                Swoole\Coroutine::sleep(1);
-                Log::record("ratio_update end sleep",Log::DEBUG);
-            }
-        }
+        Log::record("ratio_update start sleep",Log::DEBUG);
+        Swoole\Coroutine::sleep(1);
+        Log::record("ratio_update end sleep",Log::DEBUG);
+
+//        for ($i = 0; $i < 61; $i++) {
+//            $cur_time = time();
+//            $time_sec = $cur_time;
+//            $next_min = $time_sec - $time_sec % 60;
+//
+//            if($quit) break;
+//            if($next_min > $cur_min && $time_sec % 60 == 3) {
+//                $cur_min = $next_min;
+//                break;
+//            } else {
+//                Log::record("ratio_update start sleep",Log::DEBUG);
+//                Swoole\Coroutine::sleep(1);
+//                Log::record("ratio_update end sleep",Log::DEBUG);
+//            }
+//        }