Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions library/Reporting/RetryConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@

namespace Icinga\Module\Reporting;

use Exception;
use ipl\Sql\Connection;
use PDOStatement;

class RetryConnection extends Connection
{
public function prepexec($stmt, $values = null)
public function prepexec($stmt, $values = null): PDOStatement
{
try {
$sth = parent::prepexec($stmt, $values);
} catch (\Exception $e) {
} catch (Exception $e) {
$lostConnection = Str::contains($e->getMessage(), [
'server has gone away',
'no connection to the server',
Expand Down Expand Up @@ -45,7 +47,7 @@ public function prepexec($stmt, $values = null)

try {
$this->connect();
} catch (\Exception $e) {
} catch (Exception $e) {
$noConnection = Str::contains($e->getMessage(), [
'No such file or directory',
'Connection refused'
Expand All @@ -55,7 +57,7 @@ public function prepexec($stmt, $values = null)
throw $e;
}

\sleep(10);
sleep(10);

$this->connect();
}
Expand Down
Loading