mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-22 18:45: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
|
@ -59,7 +59,17 @@ $server->on('connect', function ($server, $fd) use ($log) {
|
|||
// Register a callback to handle incoming requests
|
||||
$server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pool, $log, $rateLimiter) {
|
||||
// Get a PDO connection from the pool
|
||||
$pdo = $pool->get();
|
||||
try {
|
||||
$pdo = $pool->get();
|
||||
if (!$pdo) {
|
||||
throw new PDOException("Failed to retrieve a connection from Swoole PDOPool.");
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
$log->alert("Swoole PDO Pool failed: " . $e->getMessage());
|
||||
$server->send($fd, "Database failure. Please try again later");
|
||||
$server->close($fd);
|
||||
return;
|
||||
}
|
||||
$domain = trim($data);
|
||||
|
||||
$clientInfo = $server->getClientInfo($fd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue