Store the database credentials for reconnect

This commit is contained in:
Michael 2018-06-11 03:45:45 +00:00
commit 8584e09e12
2 changed files with 26 additions and 20 deletions

View file

@ -119,6 +119,7 @@ if ($pid = pcntl_fork()) {
// We lose the database connection upon forking
dba::connect($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
Config::set('system', 'worker_daemon_mode', true);
@ -143,10 +144,9 @@ while (true) {
Worker::spawnWorker($do_cron);
if ($do_cron) {
// We force a disconnect and reconnect of the database connection.
// We force a reconnect of the database connection.
// This is done to ensure that the connection don't get lost over time.
dba::disconnect();
dba::connect($db_host, $db_user, $db_pass, $db_data);
dba::reconnect();
$last_cron = time();
}