Skip to content

Commit

Permalink
check pdo connection alive
Browse files Browse the repository at this point in the history
  • Loading branch information
hhxsv5 committed May 29, 2020
1 parent 857d92f commit 5c18317
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Connectors/PDOConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ public function disconnect($connection)
public function isConnected($connection): bool
{
/**@var \PDO $connection */
return !!$connection->getAttribute(\PDO::ATTR_SERVER_INFO);
try {
return !!$connection->getAttribute(\PDO::ATTR_SERVER_INFO);
} catch (\Throwable $e) {
return false;
}
}

public function reset($connection, array $config)
Expand Down

0 comments on commit 5c18317

Please sign in to comment.