Skip to content

Commit

Permalink
Merge pull request #5 from eithed/fix-events-duplication
Browse files Browse the repository at this point in the history
fix: events duplication
  • Loading branch information
morrislaptop authored Jul 31, 2019
2 parents 7ce435b + 795c035 commit 29b67eb
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 29b67eb

Please sign in to comment.