Connection persistency
This commit is contained in:
parent
5a32260dd2
commit
457fffc692
|
@ -305,7 +305,7 @@ App::error(function ($error, $utopia, $request, $response, $project) {
|
|||
$message = 'Server Error';
|
||||
}
|
||||
|
||||
$_SERVER = []; // Reset before reporting to error log to avoid keys being compromised
|
||||
//$_SERVER = []; // Reset before reporting to error log to avoid keys being compromised
|
||||
|
||||
$output = ((App::isDevelopment())) ? [
|
||||
'message' => $error->getMessage(),
|
||||
|
|
|
@ -122,7 +122,6 @@ $register->set('statsd', function () { // Register DB connection
|
|||
});
|
||||
$register->set('cache', function () { // Register cache connection
|
||||
$redis = new Redis();
|
||||
|
||||
$redis->pconnect(App::getEnv('_APP_REDIS_HOST', ''),
|
||||
App::getEnv('_APP_REDIS_PORT', ''));
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
use Utopia\Locale\Locale;
|
||||
|
||||
$protocol = $this->getParam('protocol', '');
|
||||
$domain = $this->getParam('domain', '');
|
||||
$platforms = $this->getParam('platforms', []);
|
||||
|
|
|
@ -51,7 +51,7 @@ class PDO
|
|||
|
||||
public function prepare($statement, array $driver_options = [])
|
||||
{
|
||||
return new PDOStatement($this->pdo, $this->pdo->prepare($statement, $driver_options));
|
||||
return new PDOStatement($this, $this->pdo->prepare($statement, $driver_options));
|
||||
}
|
||||
|
||||
public function quote($string, $parameter_type = PDONative::PARAM_STR)
|
||||
|
|
|
@ -8,7 +8,7 @@ use PDOStatement as PDOStatementNative;
|
|||
class PDOStatement
|
||||
{
|
||||
/**
|
||||
* @var PDONative
|
||||
* @var PDO
|
||||
*/
|
||||
protected $pdo;
|
||||
|
||||
|
@ -17,7 +17,7 @@ class PDOStatement
|
|||
*/
|
||||
protected $PDOStatement;
|
||||
|
||||
public function __construct(PDONative &$pdo, PDOStatementNative $PDOStatement)
|
||||
public function __construct(PDO &$pdo, PDOStatementNative $PDOStatement)
|
||||
{
|
||||
$this->pdo = $pdo;
|
||||
$this->PDOStatement = $PDOStatement;
|
||||
|
@ -46,7 +46,13 @@ class PDOStatement
|
|||
|
||||
public function execute($input_parameters = null)
|
||||
{
|
||||
try {
|
||||
$result = $this->PDOStatement->execute($input_parameters);
|
||||
} catch (\Throwable $th) {
|
||||
// throw new Exception('My Error: ' .$th->getMessage());
|
||||
$this->pdo->reconnect();
|
||||
$result = $this->PDOStatement->execute($input_parameters);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue