Skip to content

Commit 4845af1

Browse files
committed
Removed feedback option
1 parent 3e7c6c5 commit 4845af1

File tree

4 files changed

+24
-49
lines changed

4 files changed

+24
-49
lines changed

example/http_sampler.php

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,27 @@
1313
[ 'valve/delay', [ 'time' => 10 ] ],
1414
[ 'sampler/curl', [ 'url' => '%url%', 'concurrency' => 10, 'async' => false ] ],
1515
[ 'valve/timeout', [ 'time' => 10E6 ]],
16-
[ 'distribution/fork', [ 'stages' => [
17-
[ 'pipeline', [ 'stages' => [
18-
[ 'filter/keys', [ 'keys' => [ 'url', 'total_time', 'connect_time', 'concurrency']]],
19-
[ 'aggregator/collector', ['limit' => 2] ],
20-
//[ 'aggregator/describe', [ 'group_by' => 'url', 'describe' => 'total_time' ] ],
21-
[ 'encoder/json', [ 'pretty' => true ] ],
22-
'console/redraw',
23-
[ 'output/stream' ],
24-
]]],
25-
[ 'pipeline', [ 'stages' => [
26-
[ 'encoder/json' ],
27-
[ 'output/stream', [ 'stream' => 'report.json', 'mode' => 'a' ]],
28-
]]]
29-
]]],
16+
[ 'pipeline', [
17+
'stages' => [
18+
[
19+
'pipeline',
20+
['stages' => [
21+
['filter/keys', ['keys' => ['url', 'total_time', 'connect_time', 'concurrency']]],
22+
[ 'aggregator/collector', ['limit' => 2] ],
23+
//[ 'aggregator/describe', [ 'group_by' => 'url', 'describe' => 'total_time' ] ],
24+
[ 'encoder/json', [ 'pretty' => true ] ],
25+
'console/redraw',
26+
[ 'output/stream' ]
27+
]]
28+
],
29+
[
30+
'pipeline',
31+
[ 'stages' => [
32+
[ 'encoder/json' ],
33+
[ 'output/stream', [ 'stream' => 'report.json', 'mode' => 'a' ]]
34+
]]
35+
]
36+
]
37+
]],
3038
]);
3139
$builder->run();

lib/Core/Pipeline.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ public function __invoke(): Generator
2323
}
2424

2525
while (true) {
26-
if (false === $config['feedback']) {
27-
$data = $initialData;
28-
}
29-
3026
foreach ($configuredGenerators as $configuredGenerator) {
3127
$generatorConfig = $configuredGenerator->config();
3228
$generatorConfig = $this->replaceTokens($generatorConfig, $data);
@@ -53,7 +49,7 @@ public function __invoke(): Generator
5349
$data = $response;
5450
}
5551

56-
yield $data;
52+
list($config, $data) =yield $data;
5753
}
5854
}
5955

@@ -79,12 +75,10 @@ public function configure(Schema $schema)
7975
$schema->setTypes([
8076
'generator_factory' => GeneratorFactory::class,
8177
'stages' => 'array',
82-
'feedback' => 'boolean',
8378
]);
8479

8580
$schema->setDefaults([
8681
'stages' => [],
87-
'feedback' => false,
8882
]);
8983
}
9084

lib/Extension/Core/CoreExtension.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public function __construct()
3030
$this->stages = [
3131
'aggregator/collector' => new CollectorAggregator(),
3232
'aggregator/describe' => new DescribeAggregator(),
33-
'distribution/fork' => new Fork(),
3433
'encoder/json' => new JsonEncoder(),
3534
'filter/keys' => new KeysFilter(),
3635
'output/stream' => new StreamOutput(),

tests/Unit/Core/PipelineTest.php

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -159,32 +159,7 @@ function () {
159159
]);
160160
}
161161

162-
public function testCanEnableFeedback()
163-
{
164-
$stage = function () {
165-
list($config, $data) = yield;
166-
167-
for ($i = 0; $i < 2; ++$i) {
168-
$data[] = 'Hello';
169-
list($config, $data) = yield $data;
170-
}
171-
};
172-
173-
$this->factory->generatorFor(Argument::type('callable'))->will(function ($args) {
174-
return new ConfiguredGenerator($args[0](), []);
175-
});
176-
177-
$result = $this->runPipeline([
178-
$stage,
179-
$stage,
180-
], [], true);
181-
182-
$this->assertEquals([
183-
'Hello', 'Hello', 'Hello', 'Hello',
184-
], $result);
185-
}
186-
187-
private function runPipeline(array $stages, array $data = [], bool $feedback = false)
162+
private function runPipeline(array $stages, array $data = [])
188163
{
189164
$generator = (new Pipeline())();
190165

@@ -193,7 +168,6 @@ private function runPipeline(array $stages, array $data = [], bool $feedback = f
193168
$data = $generator->send([[
194169
'stages' => $stages,
195170
'generator_factory' => $this->factory->reveal(),
196-
'feedback' => $feedback,
197171
], $data]);
198172

199173
if (null === $data) {

0 commit comments

Comments
 (0)