Skip to content

Commit

Permalink
fix: events duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
eithed committed Jul 31, 2019
1 parent 7ce435b commit 795c035
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/EventStoreWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,16 @@ public function handle()

public function processAllStreams()
{
$eventStore = new EventStore();
$connection = $eventStore->connect(config('eventstore.tcp_url'));
$streams = config('eventstore.streams');

$connection->subscribe(function () use ($eventStore, $streams) {
foreach ($streams as $stream) {
foreach ($streams as $stream) {
$eventStore = new EventStore();
$connection = $eventStore->connect(config('eventstore.tcp_url'));

$connection->subscribe(function () use ($eventStore, $stream) {
$this->processStream($eventStore, $stream);
}
}, 'report');
}, 'report');
}
}

private function processStream($eventStore, string $stream)
Expand Down

0 comments on commit 795c035

Please sign in to comment.