whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [1/1] Commit d873478: Check to see if logs have been updated recently
Date Thu, 11 Feb 2016 20:31:21 GMT
Commit d8734785283e842f7ecd804dae8d0a22230d19c5:
    Check to see if logs have been updated recently


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
www/status/monitors/public_json.rb                           | +++++++++ 
------------------------------------------------------------
9 changes: 9 additions, 0 deletions.
------------------------------------------------------------


diff --git a/www/status/monitors/public_json.rb b/www/status/monitors/public_json.rb
index 7ff71b1..42e8738 100644
--- a/www/status/monitors/public_json.rb
+++ b/www/status/monitors/public_json.rb
@@ -3,6 +3,8 @@
 #
 
 def Monitor.public_json(previous_status)
+  grace_period = 86_400 # one day
+
   logs = File.expand_path('../../www/logs/public-*')
 
   status = {}
@@ -37,6 +39,13 @@ def Monitor.public_json(previous_status)
           title: "#{warnings.length} warnings"
       end
 
+      # Check to see if the log has been updated recently
+      if Time.now - File.mtime(log) > grace_period
+        status[name].merge! level: 'danger',
+          data: "Last updated: #{File.mtime(log).to_s}"
+      end
+
+      # Treat everything left as an error to be reported
       unless contents.empty?
         status[name].merge! level: 'danger', data: contents.split("\n")
       end

Mime
View raw message