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 aa7079d..ce334e0 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;
   }