Skip to content

Commit 7883c9e

Browse files
authored
Merge pull request #93 from ydb-platform/fix-backofftype-function
Fixed bug, when function Retry::backoffType always return SlowBackoff
2 parents 6fc8d9a + 65342a1 commit 7883c9e

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
# 1.8.1
2+
3+
* fixed bug, when function Retry::backoffType always return SlowBackoff
4+
15
# 1.8.0
6+
27
* update destructor in MemorySessionPool
38
* fixed exception on re-create server nodes
49
* fixed key name in createTable function

src/Retry/Retry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function retry(Closure $closure, bool $idempotent)
7878
$retryCount = 0;
7979
$lastException = null;
8080
while (microtime(true) < $startTime + $this->timeoutMs / 1000) {
81-
$this->logger->debug("YDB: Run user function. Retry count: $retryCount. Ms: ".(microtime(true) - $startTime));
81+
$this->logger->debug("YDB: Run user function. Retry count: $retryCount. s: ".(microtime(true) - $startTime));
8282
try {
8383
return $closure();
8484
} catch (Exception $e) {
@@ -89,7 +89,7 @@ public function retry(Closure $closure, bool $idempotent)
8989
}
9090
$retryCount++;
9191
$lastException = $e;
92-
$delay = $this->retryDelay($retryCount, $this->backoffType($e))*1000;
92+
$delay = $this->retryDelay($retryCount, $this->backoffType(get_class($e)))*1000;
9393
usleep($delay);
9494
}
9595
}

src/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?php
22
const MAJOR = "1";
33
const MINOR = "8";
4-
const PATCH = "0";
4+
const PATCH = "1";

tests/RetryOnExceptionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ private function retryTest(Table $table)
6969
1,
7070
$tres
7171
);
72-
}, true, new RetryParams(20000));
72+
}, true, new RetryParams(2000));
7373
}
7474
}

0 commit comments

Comments
 (0)