Skip to content

Commit b7cd57d

Browse files
authored
Merge pull request #203 from patchlevel/dont-run-on-console
dont run dev subscription listener on console
2 parents cb11a40 + dadd4f5 commit b7cd57d

File tree

5 files changed

+35
-54
lines changed

5 files changed

+35
-54
lines changed

composer.lock

Lines changed: 27 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/pages/configuration.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ patchlevel_event_sourcing:
195195
subscription:
196196
auto_setup: true
197197
```
198+
!!! note
199+
200+
This works only before each http requests and not if you use the console commands.
201+
198202
### Rebuild After File Change
199203

200204
If you want to rebuild the subscription engine after a file change, you can activate this option.
@@ -205,6 +209,10 @@ patchlevel_event_sourcing:
205209
subscription:
206210
rebuild_after_file_change: true
207211
```
212+
!!! note
213+
214+
This works only before each http requests and not if you use the console commands.
215+
208216
## Event Bus
209217

210218
You can enable the event bus to listen for events and messages synchronously.

src/DependencyInjection/PatchlevelEventSourcingExtension.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,6 @@ static function (ChildDefinition $definition): void {
371371
'event' => 'kernel.request',
372372
'priority' => 200,
373373
'method' => 'onKernelRequest',
374-
])
375-
->addTag('kernel.event_listener', [
376-
'priority' => 200,
377-
'event' => 'console.command',
378-
'method' => 'onConsoleCommand',
379374
]);
380375
}
381376

@@ -394,11 +389,6 @@ static function (ChildDefinition $definition): void {
394389
'event' => 'kernel.request',
395390
'priority' => 100,
396391
'method' => 'onKernelRequest',
397-
])
398-
->addTag('kernel.event_listener', [
399-
'priority' => 100,
400-
'event' => 'console.command',
401-
'method' => 'onConsoleCommand',
402392
]);
403393
}
404394

src/RequestListener/AutoSetupListener.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Patchlevel\EventSourcing\Subscription\Engine\SubscriptionEngine;
88
use Patchlevel\EventSourcing\Subscription\Engine\SubscriptionEngineCriteria;
99
use Patchlevel\EventSourcing\Subscription\Status;
10-
use Symfony\Component\Console\Event\ConsoleCommandEvent;
1110
use Symfony\Component\HttpKernel\Event\RequestEvent;
1211

1312
final class AutoSetupListener
@@ -29,16 +28,6 @@ public function onKernelRequest(RequestEvent $event): void
2928
return;
3029
}
3130

32-
$this->run();
33-
}
34-
35-
public function onConsoleCommand(ConsoleCommandEvent $event): void
36-
{
37-
$this->run();
38-
}
39-
40-
private function run(): void
41-
{
4231
$subscriptions = $this->subscriptionEngine->subscriptions(
4332
new SubscriptionEngineCriteria(
4433
$this->ids,

src/RequestListener/SubscriptionRebuildAfterFileChangeListener.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Patchlevel\EventSourcing\Subscription\RunMode;
1212
use Psr\Cache\CacheItemPoolInterface;
1313
use ReflectionClass;
14-
use Symfony\Component\Console\Event\ConsoleCommandEvent;
1514
use Symfony\Component\HttpKernel\Event\RequestEvent;
1615

1716
use function filemtime;
@@ -33,16 +32,6 @@ public function onKernelRequest(RequestEvent $event): void
3332
return;
3433
}
3534

36-
$this->run();
37-
}
38-
39-
public function onConsoleCommand(ConsoleCommandEvent $event): void
40-
{
41-
$this->run();
42-
}
43-
44-
private function run(): void
45-
{
4635
$toRemove = [];
4736
$itemsToSave = [];
4837

0 commit comments

Comments
 (0)