File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
lib/Extension/Core/Stage/Sampler
tests/Unit/Extension/Core/Stage/Valve Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 5
5
use PhpBench \Pipeline \Core \Stage ;
6
6
use Generator ;
7
7
use PhpBench \Pipeline \Core \Schema ;
8
+ use PhpBench \Pipeline \Core \Signal ;
8
9
9
10
class CurlSampler implements Stage
10
11
{
@@ -31,7 +32,7 @@ public function __invoke(): Generator
31
32
list ($ config , $ data ) = yield $ info ;
32
33
}
33
34
34
- usleep ( 10000 );
35
+ yield Signal:: continue ( );
35
36
}
36
37
37
38
curl_multi_close ($ this ->multiHandle );
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace PhpBench \Pipeline \Tests \Unit \Extension \Core \Stage \Valve ;
4
+
5
+ use PhpBench \Pipeline \Tests \Unit \Extension \Core \CoreTestCase ;
6
+
7
+ class DelayValveTest extends CoreTestCase
8
+ {
9
+ public function testDelaysExecution ()
10
+ {
11
+ $ start = microtime (true );
12
+ $ this ->pipeline ()
13
+ ->stage ('valve/delay ' , [ 'time ' => 10000 ])
14
+ ->generator ()
15
+ ->current ();
16
+
17
+ $ end = microtime (true );
18
+
19
+ $ this ->assertGreaterThan (10000 , ($ end - $ start ) * 1E6 );
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments