Browse Source

Apply changes to aggregate salt messages

Michael Schwarz 8 years ago
parent
commit
40a99d04c5
2 changed files with 14 additions and 1 deletions
  1. 13 0
      modules/ffpb.py
  2. 1 1
      modules/ffpb_netstatus.py

+ 13 - 0
modules/ffpb.py

@@ -77,6 +77,19 @@ class MsgHandler(SocketServer.BaseRequestHandler):
             msg_cache[msg]['nodes'].append (sender)
             return
 
+        # Aggregate identical salt changes reported from different hosts
+        match = re.search ("^(\S+): (.*)$", msg)
+        if sender == "salt" and match:
+            salt_msg = match.group (2)
+            if salt_msg not in msg_cache:
+                msg_cache[salt_msg] = {
+                    'time' : time.time (),
+                    'nodes' : []
+                }
+
+            msg_cache[salt_msg]['nodes'].append (match.group (1))
+            return
+
         bot.msg(target, "[{0}] {1}".format(sender, msg))
 
 

+ 1 - 1
modules/ffpb_netstatus.py

@@ -43,7 +43,7 @@ def shutdown(bot):
         highscores = None
 
 
-@willie.module.interval(5)
+@willie.module.interval(15)
 def ffpb_get_stats(bot):
     """Fetch current statistics, if the highscore changes signal this."""