only cache the last_update value for 10 seconds, so that we can reasonably use this...
authorRobert Kaiser <kairo@kairo.at>
Mon, 27 Jun 2016 16:48:48 +0000 (18:48 +0200)
committerRobert Kaiser <kairo@kairo.at>
Mon, 27 Jun 2016 16:48:48 +0000 (18:48 +0200)
include/classes/rrdstat.php-class

index aa7079d1892f095ceb378378183ef75d977ed393..ce334e0e6f0514f18ba5920e1a6b76d8db14a6df 100644 (file)
@@ -476,11 +476,13 @@ class rrdstat {
 
   public function last_update() {
     // fetch time of last update in this RRD file
-    static $last_update;
+    static $last_update, $last_saved;
+    if (isset($last_update) && isset($last_saved) && ($last_saved <= (time() - 10))) { unset($last_update); }
     if (!isset($last_update) && in_array($this->status, array('ok','readonly'))) {
       $last_cmd = $this->rrdtool_bin.' last '.$this->rrd_file;
       $return = trim(`$last_cmd 2>&1`);
       $last_update = is_numeric($return)?$return:null;
+      $last_saved = time();
     }
   return isset($last_update)?$last_update:null;
   }