]> git.neil.brown.name Git - plato.git/commitdiff
lock: ignore old alerts at startup.
authorNeilBrown <neilb@suse.de>
Fri, 20 Dec 2013 23:01:48 +0000 (10:01 +1100)
committerNeilBrown <neilb@suse.de>
Fri, 20 Dec 2013 23:01:48 +0000 (10:01 +1100)
utils/lock.py

index dcf9690cda9635ae0a9f0a81deb21a6ec17db155..b1940530110edd5cc7f02239ba976c82c2e4ac8f 100755 (executable)
@@ -137,6 +137,7 @@ class SetAlerts:
         # restarted
         self.alertdir = alertdir
         self.actiondir = actiondir
+        self.start = time.time()
         self.watch = dnotify.dir(alertdir)
         self.active = {}
         self.watch.watchall(self.runalert)
@@ -170,7 +171,9 @@ class SetAlerts:
             del self.active[name]
             # already disappeared
             return
-        a = self.action(name)
+        a = None
+        if w.mtime > self.start:
+            a = self.action(name)
         self.active[name] = (w, a, w.mtime)
 
     def runcheck(self, w, name):