I believe I have found the solution for our situation.
/**
* This function refreshes the whole flb_table according to our to/from dates.
*/
function refreshMe(fromTimer) {
top.restoreSession(); //<-- Added this restore top and the random time outs stopped.
if (typeof fromTimer === 'undefined' || !fromTimer) {
//Show loader in the first loading or manual loading not by timer
$("#flb_table").html('');
$('#loader').show();
skip_timeout_reset = 0;
} else {
skip_timeout_reset = 1;
}
var startRequestTime = Date.now();
top.restoreSession();
var posting = $.post('../patient_tracker/patient_tracker.php', {
flb_table: '1',
form_from_date: $("#form_from_date").val(),
form_to_date: $("#form_to_date").val(),
form_facility: $("#form_facility").val(),
form_provider: $("#form_provider").val(),
form_apptstatus: $("#form_apptstatus").val(),
form_patient_name: $("#form_patient_name").val(),
form_patient_id: $("#form_patient_id").val(),
form_apptcat: $("#form_apptcat").val(),
kiosk: $("#kiosk").val(),
skip_timeout_reset: skip_timeout_reset,
csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
}).done(
function (data) {
//minimum 400 ms of loader (In the first loading or manual loading not by timer)
if((typeof fromTimer === 'undefined' || !fromTimer) && Date.now() - startRequestTime < 400 ){
setTimeout(drawTable, 500, data);
} else {
drawTable(data)
}
});
}
I did this because of my log file had this in it when I just opened the instance and did nothing and let it close on its own.
[Fri Apr 23 21:37:26.542053 2021] [php7:notice] [pid 43774] [client 70.184.171.187:50984] Session site ID has been set to 'serenity', referer: https://ehr.thejoyofsox.com/interface/login/login.php?site=serenity
[Fri Apr 23 21:39:24.101685 2021] [php7:notice] [pid 44001] [client 71.208.153.216:54807] Site death could have occured but rerouted, referer: https://ehr.thejoyofsox.com/interface/patient_tracker/patient_tracker.php?skip_timeout_reset=1
[Fri Apr 23 21:39:24.101753 2021] [php7:notice] [pid 44001] [client 71.208.153.216:54807] Session site ID has been set to 'default', referer: https://ehr.thejoyofsox.com/interface/patient_tracker/patient_tracker.php?skip_timeout_reset=1
[Fri Apr 23 21:39:24.135371 2021] [php7:notice] [pid 44001] [client 71.208.153.216:54807] This is the site id at the time of closing - , referer: https://ehr.thejoyofsox.com/interface/patient_tracker/patient_tracker.php?skip_timeout_reset=1
[Fri Apr 23 21:39:24.135418 2021] [php7:warn] [pid 44001] [client 71.208.153.216:54807] PHP Warning: session_destroy(): Trying to destroy uninitialized session in /var/www/html/boss/src/Common/Session/SessionUtil.php on line 232, referer: https://ehr.thejoyofsox.com/interface/patient_tracker/patient_tracker.php?skip_timeout_reset=1
[Fri Apr 23 21:39:24.225654 2021] [php7:notice] [pid 44001] [client 71.208.153.216:54807] Session site ID has been set to 'default', referer: https://ehr.thejoyofsox.com/interface/patient_tracker/patient_tracker.php?skip_timeout_reset=1
[Fri Apr 23 21:39:24.547703 2021] [php7:notice] [pid 44001] [client 71.208.153.216:54807] Session site ID has been set to 'default', referer: https://ehr.thejoyofsox.com/interface/login_screen.php?error=1&site=default
[Fri Apr 23 21:43:38.056766 2021] [php7:notice] [pid 43580] [client 174.239.2.63:4743] Session site ID has been set to 'default', referer: https://ehr.thejoyofsox.com/portal/?site=serenity
[Fri Apr 23 22:09:08.513110 2021] [php7:notice] [pid 43628] [client 70.184.171.187:51853] Site death could have occured but rerouted, referer: https://ehr.thejoyofsox.com/interface/patient_tracker/patient_tracker.php?skip_timeout_reset=1
[Fri Apr 23 22:09:08.513180 2021] [php7:notice] [pid 43628] [client 70.184.171.187:51853] Session site ID has been set to 'default', referer: https://ehr.thejoyofsox.com/interface/patient_tracker/patient_tracker.php?skip_timeout_reset=1
[Fri Apr 23 22:09:08.548569 2021] [php7:notice] [pid 43628] [client 70.184.171.187:51853] This is the site id at the time of closing - , referer: https://ehr.thejoyofsox.com/interface/patient_tracker/patient_tracker.php?skip_timeout_reset=1
[Fri Apr 23 22:09:08.548628 2021] [php7:warn] [pid 43628] [client 70.184.171.187:51853] PHP Warning: session_destroy(): Trying to destroy uninitialized session in /var/www/html/boss/src/Common/Session/SessionUtil.php on line 232, referer: https://ehr.thejoyofsox.com/interface/patient_tracker/patient_tracker.php?skip_timeout_reset=1
[Fri Apr 23 22:09:08.593895 2021] [php7:notice] [pid 43628] [client 70.184.171.187:51853] Session site ID has been set to 'default', referer: https://ehr.thejoyofsox.com/interface/patient_tracker/patient_tracker.php?skip_timeout_reset=1
[Fri Apr 23 22:09:08.713331 2021] [php7:notice] [pid 43628] [client 70.184.171.187:51853] Session site ID has been set to 'default', referer: https://ehr.thejoyofsox.com/interface/login_screen.php?error=1&site=default
I added this error message (This is the site id at the time of closing - , ) to see at the time of closing where was the system coming from.
As you can also see the site was being reset to default which should not be happening for a multi-site setup.
I also added the (Site death could have occurred but rerouted,) so that the site id missing message was rerouted to the site id in the URL that was not in the session.
This is the end of my report.