e
This commit is contained in:
+11
-2
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Database\Mysql;
|
namespace Database\Mysql;
|
||||||
|
|
||||||
|
use Annotation\Inject;
|
||||||
use Exception;
|
use Exception;
|
||||||
use HttpServer\Http\Context;
|
use HttpServer\Http\Context;
|
||||||
use Kiri\Events\EventProvider;
|
use Kiri\Events\EventProvider;
|
||||||
@@ -21,6 +22,10 @@ class PDO
|
|||||||
private int $_transaction = 0;
|
private int $_transaction = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var EventProvider
|
||||||
|
*/
|
||||||
|
#[Inject(EventProvider::class)]
|
||||||
private EventProvider $eventProvider;
|
private EventProvider $eventProvider;
|
||||||
|
|
||||||
private int $_timer = -1;
|
private int $_timer = -1;
|
||||||
@@ -34,13 +39,17 @@ class PDO
|
|||||||
* @param string $username
|
* @param string $username
|
||||||
* @param string $password
|
* @param string $password
|
||||||
* @param string $chatset
|
* @param string $chatset
|
||||||
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function __construct(public string $dbname, public string $cds,
|
public function __construct(public string $dbname, public string $cds,
|
||||||
public string $username, public string $password, public string $chatset = 'utf8mb4')
|
public string $username, public string $password, public string $chatset = 'utf8mb4')
|
||||||
{
|
{
|
||||||
$this->heartbeat_check();
|
}
|
||||||
|
|
||||||
$this->eventProvider = di(EventProvider::class);
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
$this->heartbeat_check();
|
||||||
$this->eventProvider->on(OnWorkerExit::class, [$this, 'stopHeartbeatCheck']);
|
$this->eventProvider->on(OnWorkerExit::class, [$this, 'stopHeartbeatCheck']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user