Store the database credentials for reconnect
This commit is contained in:
parent
b02cdc8a7f
commit
8584e09e12
2 changed files with 26 additions and 20 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue