test.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. declare(strict_types=0);
  3. define('APP_ID', 'rdispatcher');
  4. define('MOBILE_SERVER',true);
  5. define('BASE_ROOT_PATH',str_replace('/rdispatcher','',dirname(__FILE__)));
  6. define('BASE_PATH',BASE_ROOT_PATH . '/rdispatcher');
  7. require_once(BASE_ROOT_PATH . '/global.php');
  8. require_once(BASE_ROOT_PATH . '/fooder.php');
  9. //require_once(BASE_ROOT_PATH . '/helper/event_looper.php');
  10. //require_once(BASE_HELPER_PATH . '/queue/rdispatcher.php');
  11. //require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
  12. require_once(BASE_PATH . '/processor.php');
  13. //require_once(BASE_PATH . '/proxy.php');
  14. //require_once(BASE_PATH . '/yzpolicy.php');
  15. require_once(BASE_ROOT_PATH . '/core/framework/function/http.php');
  16. Co::set(['hook_flags' => SWOOLE_HOOK_ALL]);
  17. Co\run(function()
  18. {
  19. $n = 1000;
  20. $i = 0;
  21. Log::record("start {$i}", Log::DEBUG);
  22. while ($n--) {
  23. go(function () use ($i) {
  24. Log::record("start {$i}", Log::DEBUG);
  25. $resp = http_request('https://www.xyzshops.cn/mobile/index.php?act=index&op=index&client_type=ios');
  26. Log::record("recv {$i} size=" . strlen($resp), Log::DEBUG);
  27. $resp = http_request('https://www.xyzshops.cn/mobile/index.php?act=index&op=index&client_type=ios');
  28. Log::record("recv {$i} size=" . strlen($resp), Log::DEBUG);
  29. $resp = http_request('https://www.xyzshops.cn/mobile/index.php?act=index&op=index&client_type=ios');
  30. Log::record("recv {$i} size=" . strlen($resp), Log::DEBUG);
  31. });
  32. $i++;
  33. Co::sleep(0.0001);
  34. }
  35. });