Fixed Speedtest Logic

This commit is contained in:
Riccardo Bicelli 2021-07-07 10:05:25 +02:00
parent 5a36f380fd
commit f1d7ca8e5d
1 changed files with 1 additions and 8 deletions

View File

@ -205,14 +205,7 @@ function pfz_speedtest_exec ($ifname, $ipaddr){
$filename = "/tmp/speedtest-$ifname";
$filerun = "/tmp/speedtest-run";
$filecron = "/tmp/speedtest.cron";
if (file_exists($filename)) {
$json_output = json_decode(file_get_contents($filename), true);
if ($json_output==null) @unlink($filename);
return $json_output;
}
$filecron = "/tmp/speedtest.cron";
if ( (time()-filemtime($filename) > SPEEDTEST_INTERVAL * 3600) || (file_exists($filename)==false) ) {
// file is older than SPEEDTEST_INTERVAL