for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Ez\DbLinker\RetryStrategy;
use Exception;
use Ez\DbLinker\RetryStrategy as RetryStrategyInterface;
class PostgreSQLRetryStrategy implements RetryStrategyInterface
{
use RetryStrategy;
private function errorCodeStrategies() {
return [
// CONNECTION FAILURE
"08006" => ["changeServer" => true],
// TOO MANY CONNECTIONS
"53300" => ["wait" => 1],
];
}
private function errorCode(Exception $exception)
if(preg_match("/SQLSTATE\[(?<errorCode>[A-Z0-9]*)\]/", $exception->getMessage(), $matches)) {
$code = $matches["errorCode"];
if ($code === 'HY000') {
$code = '08006';
return $code;