From 978a1651bac3faf5e91ddba327bf39aeb6a4cb63 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:28:59 +0200 Subject: Adding upstream version 0.10.0. Signed-off-by: Daniel Baumann --- library/Reporting/RetryConnection.php | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 library/Reporting/RetryConnection.php (limited to 'library/Reporting/RetryConnection.php') diff --git a/library/Reporting/RetryConnection.php b/library/Reporting/RetryConnection.php new file mode 100644 index 0000000..ebadfd2 --- /dev/null +++ b/library/Reporting/RetryConnection.php @@ -0,0 +1,66 @@ +getMessage(), [ + 'server has gone away', + 'no connection to the server', + 'Lost connection', + 'Error while sending', + 'is dead or not enabled', + 'decryption failed or bad record mac', + 'server closed the connection unexpectedly', + 'SSL connection has been closed unexpectedly', + 'Error writing data to the connection', + 'Resource deadlock avoided', + 'Transaction() on null', + 'child connection forced to terminate due to client_idle_limit', + 'query_wait_timeout', + 'reset by peer', + 'Physical connection is not usable', + 'TCP Provider: Error code 0x68', + 'ORA-03114', + 'Packets out of order. Expected', + 'Adaptive Server connection failed', + 'Communication link failure', + ]); + + if (! $lostConnection) { + throw $e; + } + + $this->disconnect(); + + try { + $this->connect(); + } catch (\Exception $e) { + $noConnection = Str::contains($e->getMessage(), [ + 'No such file or directory', + 'Connection refused' + ]); + + if (! $noConnection) { + throw $e; + } + + \sleep(10); + + $this->connect(); + } + + $sth = parent::prepexec($stmt, $values); + } + + return $sth; + } +} -- cgit v1.2.3