Skip to content

Commit

Permalink
Minor code-formating & adjustmnets to follow same style than InMemory…
Browse files Browse the repository at this point in the history
… projections
  • Loading branch information
fritz-gerneth committed Jul 2, 2017
1 parent 2514676 commit 5432dc9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
17 changes: 8 additions & 9 deletions src/Projection/PdoEventStoreProjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ public function __construct(
int $sleep,
bool $triggerPcntlSignalDispatch = false
) {
if ($triggerPcntlSignalDispatch && ! extension_loaded('pcntl')) {
throw Exception\ExtensionNotLoadedException::withName('pcntl');
}

$this->eventStore = $eventStore;
$this->connection = $connection;
$this->name = $name;
Expand All @@ -170,7 +174,7 @@ public function __construct(
$this->persistBlockSize = $persistBlockSize;
$this->sleep = $sleep;
$this->status = ProjectionStatus::IDLE();
$this->triggerPcntlSignalDispatch = $triggerPcntlSignalDispatch && extension_loaded('pcntl');
$this->triggerPcntlSignalDispatch = $triggerPcntlSignalDispatch;

while ($eventStore instanceof EventStoreDecorator) {
$eventStore = $eventStore->getInnerEventStore();
Expand Down Expand Up @@ -505,7 +509,9 @@ public function run(bool $keepRunning = true): void

$this->eventCounter = 0;

$this->triggerPcntlSignalDispatch();
if ($this->triggerPcntlSignalDispatch) {
pcntl_signal_dispatch();
}

switch ($this->fetchRemoteStatus()) {
case ProjectionStatus::STOPPING():
Expand Down Expand Up @@ -866,11 +872,4 @@ private function prepareStreamPositions(): void

$this->streamPositions = array_merge($streamPositions, $this->streamPositions);
}

private function triggerPcntlSignalDispatch(): void
{
if ($this->triggerPcntlSignalDispatch) {
pcntl_signal_dispatch();
}
}
}
17 changes: 8 additions & 9 deletions src/Projection/PdoEventStoreReadModelProjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ public function __construct(
int $sleep,
bool $triggerPcntlSignalDispatch = false
) {
if ($triggerPcntlSignalDispatch && ! extension_loaded('pcntl')) {
throw Exception\ExtensionNotLoadedException::withName('pcntl');
}

$this->eventStore = $eventStore;
$this->connection = $connection;
$this->name = $name;
Expand All @@ -157,7 +161,7 @@ public function __construct(
$this->persistBlockSize = $persistBlockSize;
$this->sleep = $sleep;
$this->status = ProjectionStatus::IDLE();
$this->triggerPcntlSignalDispatch = $triggerPcntlSignalDispatch && extension_loaded('pcntl');
$this->triggerPcntlSignalDispatch = $triggerPcntlSignalDispatch;

while ($eventStore instanceof EventStoreDecorator) {
$eventStore = $eventStore->getInnerEventStore();
Expand Down Expand Up @@ -465,7 +469,9 @@ public function run(bool $keepRunning = true): void

$this->eventCounter = 0;

$this->triggerPcntlSignalDispatch();
if ($this->triggerPcntlSignalDispatch) {
pcntl_signal_dispatch();
}

switch ($this->fetchRemoteStatus()) {
case ProjectionStatus::STOPPING():
Expand Down Expand Up @@ -816,11 +822,4 @@ private function prepareStreamPositions(): void

$this->streamPositions = array_merge($streamPositions, $this->streamPositions);
}

private function triggerPcntlSignalDispatch(): void
{
if ($this->triggerPcntlSignalDispatch) {
pcntl_signal_dispatch();
}
}
}
8 changes: 8 additions & 0 deletions tests/Projection/isolated-projection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<?php
/**
* This file is part of the prooph/pdo-event-store.
* (c) 2016-2017 prooph software GmbH <[email protected]>
* (c) 2016-2017 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

Expand Down
8 changes: 8 additions & 0 deletions tests/Projection/isolated-read-model-projection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<?php
/**
* This file is part of the prooph/pdo-event-store.
* (c) 2016-2017 prooph software GmbH <[email protected]>
* (c) 2016-2017 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

Expand Down

0 comments on commit 5432dc9

Please sign in to comment.