mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 23:43:12 +00:00
Cleaning opened connections
This commit is contained in:
@@ -19,9 +19,11 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
|
|
||||||
class task_Scheduler
|
class task_Scheduler
|
||||||
{
|
{
|
||||||
|
|
||||||
const TASKDELAYTOQUIT = 60;
|
const TASKDELAYTOQUIT = 60;
|
||||||
|
|
||||||
protected $output;
|
protected $output;
|
||||||
|
protected static $connection;
|
||||||
|
|
||||||
protected function log($message)
|
protected function log($message)
|
||||||
{
|
{
|
||||||
@@ -47,7 +49,12 @@ class task_Scheduler
|
|||||||
{
|
{
|
||||||
require dirname(__FILE__) . '/../../../config/connexion.inc';
|
require dirname(__FILE__) . '/../../../config/connexion.inc';
|
||||||
|
|
||||||
return new connection_pdo('appbox', $hostname, $port, $user, $password, $dbname);
|
if (!self::$connection)
|
||||||
|
{
|
||||||
|
self::$connection = new connection_pdo ('appbox', $hostname, $port, $user, $password, $dbname);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run(OutputInterface $output = null, $log_tasks = true)
|
public function run(OutputInterface $output = null, $log_tasks = true)
|
||||||
@@ -523,6 +530,7 @@ class task_Scheduler
|
|||||||
{
|
{
|
||||||
$conn->close();
|
$conn->close();
|
||||||
unset($conn);
|
unset($conn);
|
||||||
|
self::$connection = null;
|
||||||
$to_reopen = true;
|
$to_reopen = true;
|
||||||
}
|
}
|
||||||
sleep($sleeptime);
|
sleep($sleeptime);
|
||||||
|
Reference in New Issue
Block a user