From 5a6b4f5eed2f528fa8138584790a01b1051dfafd Mon Sep 17 00:00:00 2001 From: prolic Date: Thu, 20 Oct 2022 20:57:11 -0300 Subject: [PATCH] fix gap detection resolves https://github.com/prooph/pdo-event-store/issues/243 --- src/Projection/PdoEventStoreProjector.php | 6 ++---- src/Projection/PdoEventStoreReadModelProjector.php | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Projection/PdoEventStoreProjector.php b/src/Projection/PdoEventStoreProjector.php index 0b0e3c8..2627ca4 100644 --- a/src/Projection/PdoEventStoreProjector.php +++ b/src/Projection/PdoEventStoreProjector.php @@ -551,16 +551,14 @@ public function run(bool $keepRunning = true): void } if ($gapDetected && $this->gapDetection) { - $sleep = $this->gapDetection->getSleepForNextRetry(); - - \usleep($sleep); + \usleep($this->gapDetection->getSleepForNextRetry() * 1000); $this->gapDetection->trackRetry(); $this->persist(); } else { $this->gapDetection && $this->gapDetection->resetRetries(); if (0 === $this->eventCounter) { - \usleep($this->sleep); + \usleep($this->sleep * 1000); $this->updateLock(); } else { $this->persist(); diff --git a/src/Projection/PdoEventStoreReadModelProjector.php b/src/Projection/PdoEventStoreReadModelProjector.php index 836abc2..721a9e8 100644 --- a/src/Projection/PdoEventStoreReadModelProjector.php +++ b/src/Projection/PdoEventStoreReadModelProjector.php @@ -514,16 +514,14 @@ public function run(bool $keepRunning = true): void } if ($gapDetected && $this->gapDetection) { - $sleep = $this->gapDetection->getSleepForNextRetry(); - - \usleep($sleep); + \usleep($this->gapDetection->getSleepForNextRetry() * 1000); $this->gapDetection->trackRetry(); $this->persist(); } else { $this->gapDetection && $this->gapDetection->resetRetries(); if (0 === $this->eventCounter) { - \usleep($this->sleep); + \usleep($this->sleep * 1000); $this->updateLock(); } else { $this->persist();