Skip to content

Commit 382ec1d

Browse files
author
Илья
committed
Refactor delay
1 parent eb006ec commit 382ec1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

slo-workload/src/Commands/RunCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ protected function readJob(string $endpoint, string $path, $tableName, int $init
213213
$table->getLogger()->error($e->getMessage());
214214
Utils::metricFail("read", $this->queueId, $attemps, get_class($e), $this->getLatency($begin));
215215
} finally {
216-
$delay = ($begin - microtime(true)) * 1e6 + 1e6 / Defaults::RPS_PER_WRITE_FORK;
216+
$delay = $begin * 1e6 + 1e6 / Defaults::RPS_PER_WRITE_FORK - microtime(true);
217217
usleep($delay > 0 ? $delay : 1);
218218
}
219219
}
@@ -246,7 +246,7 @@ protected function writeJob(string $endpoint, string $path, $tableName, int $ini
246246
$table->getLogger()->error($e->getMessage());
247247
Utils::metricFail("write", $this->queueId, $attemps, get_class($e), $this->getLatency($begin));
248248
} finally {
249-
$delay = ($begin - microtime(true)) * 1e6 + 1e6 / Defaults::RPS_PER_READ_FORK;
249+
$delay = $begin * 1e6 + 1e6 / Defaults::RPS_PER_READ_FORK - microtime(true);
250250
usleep($delay > 0 ? $delay : 1);
251251
}
252252
}

0 commit comments

Comments
 (0)