Skip to content

Commit

Permalink
igr close connection error
Browse files Browse the repository at this point in the history
  • Loading branch information
sakuraovq committed Apr 12, 2020
1 parent 52cf587 commit 0b3b7bd
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/connection-pool/src/AbstractPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ public function close(): int
continue;
}

$connection->close();
try {
// May be disconnected
$connection->close();
} catch (Throwable $e) {
CLog::warning('Pool close connection error ' . $e->getMessage());
}
}

return $this->count;
Expand Down Expand Up @@ -275,8 +280,12 @@ private function popByChannel(): ?ConnectionInterface
// Out of `maxIdleTime`
if ($time - $lastTime > $this->maxIdleTime) {

// Fix expired connection not released
$connection->close();
try {
// Fix expired connection not released, May be disconnected
$connection->close();
} catch (Throwable $e) {
CLog::warning('popByChannel close connection error ' . $e->getMessage());
}

$this->count--;
continue;
Expand Down

0 comments on commit 0b3b7bd

Please sign in to comment.