This commit is contained in:
2023-08-18 15:04:39 +08:00
parent 0ea9339816
commit 1fb13aa3a3
+7 -2
View File
@@ -157,6 +157,11 @@ class Connection extends Component
if ($data === false) {
throw new Exception('Pool waite timeout at ' . $this->waite_time);
}
if (is_object($data)) {
return $data;
}
[$client, $time] = $data;
if ((time() - $time) < $this->idle_time && $this->canUse($client)) {
return $client;
@@ -262,7 +267,7 @@ class Connection extends Component
if ($pdo->inTransaction()) {
$pdo->commit();
}
$this->pool()->push($this->cds, $pdo);
$this->pool()->push($this->cds, [$pdo, time()]);
Context::remove($this->cds);
}
}
@@ -282,7 +287,7 @@ class Connection extends Component
if ($pdo->inTransaction()) {
$pdo->rollback();
}
$this->pool()->push($this->cds, $pdo);
$this->pool()->push($this->cds, [$pdo, time()]);
Context::remove($this->cds);
}