Skip to content

Commit 6af90bb

Browse files
committed
Add ConcurrencyTest
1 parent a4cb187 commit 6af90bb

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/ConcurrencyTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: eagle
5+
* Date: 06/03/2018
6+
* Time: 15:39
7+
*/
8+
9+
use Ecs\Request\V20140526 as Ecs;
10+
11+
class ConcurrencyTest extends TestCase
12+
{
13+
14+
public function testDescribeInstances()
15+
{
16+
$request = new Ecs\DescribeInstancesRequest();
17+
18+
// 创建10个请求,同时发送
19+
for ($i = 0; $i < 10; $i++) {
20+
$requests[] = $this->acsClient->buildHttpRequest($request);
21+
}
22+
23+
$successful = function ($object, $response, $index, $args) {
24+
echo "Successful #$index: " . $object->RequestId . "\n";
25+
};
26+
$rejected = function ($reason, $index, $args) {
27+
echo "Failed #$index: $reason\n";
28+
};
29+
30+
$this->acsClient->sendMultiRequests($requests, $successful, $rejected, 10, [123, 456]);
31+
}
32+
33+
}

0 commit comments

Comments
 (0)