mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Cleaning opened connections
This commit is contained in:
@@ -19,9 +19,11 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class task_Scheduler
|
||||
{
|
||||
|
||||
const TASKDELAYTOQUIT = 60;
|
||||
|
||||
protected $output;
|
||||
protected static $connection;
|
||||
|
||||
protected function log($message)
|
||||
{
|
||||
@@ -47,7 +49,12 @@ class task_Scheduler
|
||||
{
|
||||
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)
|
||||
@@ -523,6 +530,7 @@ class task_Scheduler
|
||||
{
|
||||
$conn->close();
|
||||
unset($conn);
|
||||
self::$connection = null;
|
||||
$to_reopen = true;
|
||||
}
|
||||
sleep($sleeptime);
|
||||
|
Reference in New Issue
Block a user