From 2034c70d507153f53d93d9f620cafd675b8bd9ed Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 8 Jul 2010 17:09:03 +0200
Subject: [PATCH] jqueue: Setup inotify before checking for any job changes

Since the code waiting for job changes was modified to use inotify,
a race condition between checking for changes the first time and
setting up inotify occurs. If the job is modified after the check
but before inotify is active, changes would only be noticed after
the timeout (29 seconds in most cases) expired.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/jqueue.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/jqueue.py b/lib/jqueue.py
index 8ba08e20c..6f19ba427 100644
--- a/lib/jqueue.py
+++ b/lib/jqueue.py
@@ -575,6 +575,7 @@ class _WaitForJobChangesHelper(object):
     self.notifier.process_events()
 
   def WaitForChanges(self, timeout):
+    self._SetupInotify()
     try:
       return utils.Retry(self._CheckForChanges,
                          utils.RETRY_REMAINING_TIME,
-- 
GitLab