Skip to content

Commit 93a2c48

Browse files
committed
Fixed some bad refactorings in the workflow runtime
1 parent c3e241e commit 93a2c48

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Console.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
use Kiboko\Component\Pipeline\Pipeline;
88
use Kiboko\Contract\Pipeline\PipelineRunnerInterface;
99
use Kiboko\Contract\Pipeline\RunnableInterface;
10-
use Kiboko\Contract\Pipeline\SchedulingInterface;
1110
use Symfony\Component\Console\Output\ConsoleOutput;
1211

1312
final class Console implements WorkflowRuntimeInterface
1413
{
1514
private State\StateOutput\Workflow $state;
1615

16+
/** @var list<RunnableInterface> */
17+
private array $jobs = [];
18+
1719
public function __construct(
1820
private ConsoleOutput $output,
19-
private SchedulingInterface $workflow,
2021
private PipelineRunnerInterface $pipelineRunner,
2122
) {
2223
$this->state = new State\StateOutput\Workflow($output);
@@ -27,22 +28,22 @@ public function loadPipeline(string $filename): PipelineConsoleRuntime
2728
$factory = require $filename;
2829

2930
$pipeline = new Pipeline($this->pipelineRunner);
30-
$this->workflow->job($pipeline);
31+
$this->job($pipeline);
3132

3233
return $factory(new PipelineConsoleRuntime($this->output, $pipeline, $this->state->withPipeline(basename($filename))));
3334
}
3435

3536
public function job(RunnableInterface $job): self
3637
{
37-
$this->workflow->job($job);
38+
$this->jobs[] = $job;
3839

3940
return $this;
4041
}
4142

4243
public function run(int $interval = 1000): int
4344
{
4445
$count = 0;
45-
foreach ($this->workflow->walk() as $job) {
46+
foreach ($this->jobs as $job) {
4647
$count = $job->run($interval);
4748
}
4849
return $count;

0 commit comments

Comments
 (0)