12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- function ratio_update(&$quit)
- {
- //每分钟的第0秒 将上一分钟的数据,写入HD5File。
- //每分钟的第2秒 统计之前的数据
- //每分钟的第3秒触发更新 成功率统计数据
- $cur_min = 0;
- while (!$quit) {
- Log::record("ratio_update start calc quit =" . strbool($quit), Log::DEBUG);
- Log::record("ratio_update start sleep", Log::DEBUG);
- // Co::sleep(1);
- Swoole\Coroutine\System::sleep(1);
- // 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);
- // }
- // }
- // if(!$quit) {
- // refill\RefillFactory::instance()->UpdateRatio();
- // }
- // }
- //
- // Log::record("ratio_update quit =". strbool($quit),Log::DEBUG);
- // $quit = true;
- //}
|