Skip empty cache files

This commit is contained in:
Witek Bedyk 2021-11-18 13:37:56 +01:00
parent c8d2cf77ce
commit 3eae2f73c7

View File

@ -164,7 +164,7 @@ function aggregate_all($period)
$data = null; $data = null;
foreach (PROTOCOLS as $protocol) { foreach (PROTOCOLS as $protocol) {
$cache_file = "$CACHE_DIR/$protocol/$date_string.json"; $cache_file = "$CACHE_DIR/$protocol/$date_string.json";
if (!file_exists($cache_file)) continue; if (!file_exists($cache_file) or !filesize($cache_file)) continue;
error_log("[$date_string] [$protocol] load cache"); error_log("[$date_string] [$protocol] load cache");
$data_new = json_decode(file_get_contents($cache_file), true); $data_new = json_decode(file_get_contents($cache_file), true);