* new configurable: status_interval (how often to fetch status from server)

This commit is contained in:
slawkens 2018-06-01 18:23:48 +02:00
parent 857ce1324c
commit db67bb0b98
2 changed files with 21 additions and 6 deletions

View File

@ -235,6 +235,11 @@ $config = array(
'status_port' => '', 'status_port' => '',
'status_timeout' => 2, // how long to wait for the initial response from the server (default: 2 seconds) 'status_timeout' => 2, // how long to wait for the initial response from the server (default: 2 seconds)
// how often to connect to server and update status (default: every minute)
// if your status timeout in config.lua is bigger, that it will be used instead
// when server is offline, it will be checked every time web refreshes, ignoring this variable
'status_interval' => 60,
// other // other
'anonymous_usage_statistics' => true, 'anonymous_usage_statistics' => true,
'email_lai_sec_interval' => 60, // time in seconds between e-mails to one account from lost account interface, block spam 'email_lai_sec_interval' => 60, // time in seconds between e-mails to one account from lost account interface, block spam

View File

@ -29,16 +29,23 @@ else if(isset($config['lua']['status_port'])) {
$status_port = $config['lua']['status_port']; $status_port = $config['lua']['status_port'];
} }
$status_port = $config['lua']['statusPort']; // ip check
if(isset($config['status_ip'][0])) if(isset($config['status_ip'][0]))
{ {
$status_ip = $config['status_ip']; $status_ip = $config['status_ip'];
$status_port = $config['status_port'];
} }
else if(!isset($status_ip[0])) // try localhost if no ip specified elseif(!isset($status_ip[0])) // try localhost if no ip specified
{ {
$status_ip = '127.0.0.1'; $status_ip = '127.0.0.1';
}
// port check
$status_port = $config['lua']['statusPort'];
if(isset($config['status_port'][0])) {
$status_port = $config['status_port'];
}
elseif(!isset($status_port[0])) // try 7171 if no ip specified
{
$status_port = 7171; $status_port = 7171;
} }
@ -74,6 +81,9 @@ if(isset($config['lua']['statustimeout']))
// get status timeout from server config // get status timeout from server config
$status_timeout = eval('return ' . $config['lua']['statusTimeout'] . ';') / 1000 + 1; $status_timeout = eval('return ' . $config['lua']['statusTimeout'] . ';') / 1000 + 1;
if($status_timeout < $config['status_interval']) {
$status_timeout = $config['status_interval'];
}
if($status['lastCheck'] + $status_timeout < time()) { if($status['lastCheck'] + $status_timeout < time()) {
updateStatus(); updateStatus();