diff --git a/src/Worker/Transport/Command/Client/Request.php b/src/Worker/Transport/Command/Client/Request.php index d39819961..a6cde2cbb 100644 --- a/src/Worker/Transport/Command/Client/Request.php +++ b/src/Worker/Transport/Command/Client/Request.php @@ -48,6 +48,14 @@ public function __construct( $this->id = $this->getNextID(); } + /** + * @internal + */ + public static function resetLastId(int $lastID): void + { + self::$lastID = $lastID; + } + public function getID(): int { return $this->id; @@ -65,12 +73,14 @@ public function getFailure(): ?\Throwable private function getNextID(): int { - $next = ++static::$lastID; + ++static::$lastID; - if ($next >= \PHP_INT_MAX) { - $next = static::$lastID = 1; + if (static::$lastID === \PHP_INT_MAX) { + static::$lastID = 1; } - return $next; + return static::$lastID; } } + +Request::resetLastId((int) (\microtime(true) * 1_000_000.0)); diff --git a/tests/Fixtures/CommandResetter.php b/tests/Fixtures/CommandResetter.php deleted file mode 100644 index afb13f529..000000000 --- a/tests/Fixtures/CommandResetter.php +++ /dev/null @@ -1,22 +0,0 @@ -factory = WorkerFactory::create(); $mock->registerWorkflowAndActivities(); - CommandResetter::reset(); + Request::resetLastId(9000); return $mock; }