|
@@ -12,32 +12,29 @@ define('BASE_PATH',BASE_ROOT_PATH . '/server');
|
|
|
|
|
|
require_once(BASE_ROOT_PATH . '/global.php');
|
|
|
require_once(BASE_ROOT_PATH . '/fooder.php');
|
|
|
-
|
|
|
-Log::record(__FILE__ . " 1",Log::DEBUG);
|
|
|
-
|
|
|
require_once(BASE_CORE_PATH . '/framework/function/http.php');
|
|
|
require_once(BASE_HELPER_PATH . '/refill_proxy.php');
|
|
|
-
|
|
|
-Log::record(__FILE__ . " 2",Log::DEBUG);
|
|
|
-
|
|
|
Co::set(['hook_flags' => SWOOLE_HOOK_NATIVE_CURL|SWOOLE_HOOK_SLEEP]);
|
|
|
|
|
|
-Log::record(__FILE__ . " 3",Log::DEBUG);
|
|
|
-
|
|
|
-
|
|
|
class RefillSender
|
|
|
{
|
|
|
- const co_routines = 1000;
|
|
|
- const co_orders = 1000;
|
|
|
+ const co_orders = 100000;
|
|
|
|
|
|
- public function send($index)
|
|
|
+ public function sendex()
|
|
|
{
|
|
|
- $count = self::co_orders;
|
|
|
- $time = time() * 1000 + $index;
|
|
|
-
|
|
|
$pThis = $this;
|
|
|
- for ($i = 0; $i < $count; $i++)
|
|
|
+ $time = time() * 1000;
|
|
|
+
|
|
|
+ for ($i = 0;$i < self::co_orders; )
|
|
|
{
|
|
|
+ $res = Swoole\Coroutine::stats();
|
|
|
+ $num = $res['coroutine_num'];
|
|
|
+
|
|
|
+ if($num > 10000) {
|
|
|
+ sleep(0.1);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $i++;
|
|
|
Log::record(__FUNCTION__ . " index={$i}",Log::DEBUG);
|
|
|
go(function () use ($pThis,$time,$i) {
|
|
|
$pThis->push_order(1092, $time, $i);
|
|
@@ -45,19 +42,6 @@ class RefillSender
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function sendex()
|
|
|
- {
|
|
|
- $count = self::co_routines;
|
|
|
- $pThis = $this;
|
|
|
- for ($i = 0;$i < $count; $i++)
|
|
|
- {
|
|
|
- Log::record(__FUNCTION__ . " index={$i}",Log::DEBUG);
|
|
|
- go(function () use ($pThis,$i) {
|
|
|
- $pThis->send($i);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private function push_order($mchid,$time,$index)
|
|
|
{
|
|
|
$notify_url = "https://test.xyzshops.cn/mobile/callback/bridge_test.php";
|
|
@@ -76,10 +60,6 @@ class RefillSender
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//docker run busybox nslookup test.xyzshops.cn
|
|
|
-//$sender = new RefillSender();
|
|
|
-//$sender->send(1);
|
|
|
-
|
|
|
Log::record("send message start",Log::DEBUG);
|
|
|
go(function () {
|
|
|
$sender = new RefillSender();
|