mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-16 17:46:59 +02:00
Further work on better logging
This commit is contained in:
parent
595d10349c
commit
2adce55a07
6 changed files with 69 additions and 78 deletions
|
@ -95,11 +95,14 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
|||
|
||||
$log->info('new client from ' . $clientIP . ' connected');
|
||||
sendGreeting($conn);
|
||||
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
// Get a PDO connection from the pool
|
||||
$pdo = $pool->get();
|
||||
if (!$pdo) {
|
||||
throw new PDOException("Failed to retrieve a connection from Swoole PDOPool.");
|
||||
}
|
||||
$data = $conn->recv();
|
||||
$connId = spl_object_id($conn);
|
||||
|
||||
|
@ -572,7 +575,7 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
|||
}
|
||||
} catch (PDOException $e) {
|
||||
// Handle database exceptions
|
||||
$log->error('Database error: ' . $e->getMessage());
|
||||
$log->alert('Database error: ' . $e->getMessage());
|
||||
|
||||
// Here we only retry if it's a *connection* failure.
|
||||
// Common MySQL connection error codes: 2002 (Can't connect), 2006 (Gone away), 2013 (Lost connection).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue