Skip to content

Commit 3e30035

Browse files
committed
Add log on reconnect
1 parent ce0005d commit 3e30035

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Database/PDO.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Utopia\Database;
44

55
use Swoole\Database\DetectsLostConnections;
6+
use Utopia\CLI\Console;
67

78
/**
89
* A PDO wrapper that forwards method calls to the internal PDO instance.
@@ -46,6 +47,7 @@ public function __call(string $method, array $args): mixed
4647
} catch (\Throwable $e) {
4748
/** @phpstan-ignore-next-line can't find static method */
4849
if (DetectsLostConnections::causedByLostConnection($e)) {
50+
Console::warning('[Database] Lost connection detected. Reconnecting...');
4951
$this->reconnect();
5052
return $this->pdo->{$method}(...$args);
5153
}

0 commit comments

Comments
 (0)