改名
This commit is contained in:
@@ -192,7 +192,7 @@ abstract class Pool extends Component
|
|||||||
$this->creates = Timer::tick(1000, [$this, 'Heartbeat_detection']);
|
$this->creates = Timer::tick(1000, [$this, 'Heartbeat_detection']);
|
||||||
}
|
}
|
||||||
if (!Context::hasContext('create::client::ing::' . $name)) {
|
if (!Context::hasContext('create::client::ing::' . $name)) {
|
||||||
$this->push($name, $this->createClient($name, $callback));
|
$this->_items[$name]->push($this->createClient($name, $callback));
|
||||||
Context::remove('create::client::ing::' . $name);
|
Context::remove('create::client::ing::' . $name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -298,6 +298,7 @@ abstract class Pool extends Component
|
|||||||
if (!$this->_items[$name]->isFull()) {
|
if (!$this->_items[$name]->isFull()) {
|
||||||
$this->_items[$name]->push($client);
|
$this->_items[$name]->push($client);
|
||||||
}
|
}
|
||||||
|
$this->remove($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -187,19 +187,15 @@ class Connection extends Pool
|
|||||||
public function release($coroutineName, $isMaster)
|
public function release($coroutineName, $isMaster)
|
||||||
{
|
{
|
||||||
$coroutineName = $this->name('mysql', $coroutineName, $isMaster);
|
$coroutineName = $this->name('mysql', $coroutineName, $isMaster);
|
||||||
if (!$this->hasClient($coroutineName)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// $this->error('Worker ' . env('worker') . ' recover db client ' . $coroutineName . ' length ' . $this->size($coroutineName));
|
|
||||||
|
|
||||||
/** @var PDO $client */
|
/** @var PDO $client */
|
||||||
$client = Context::getContext($coroutineName);
|
if (!($client = Context::getContext($coroutineName)) instanceof PDO) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ($client->inTransaction()) {
|
if ($client->inTransaction()) {
|
||||||
$client->commit();
|
$client->commit();
|
||||||
}
|
}
|
||||||
$this->push($coroutineName, $client);
|
$this->push($coroutineName, $client);
|
||||||
$this->remove($coroutineName);
|
|
||||||
$this->lastTime = time();
|
$this->lastTime = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user