Forráskód Böngészése

unlink pid file is it's stale

Ask Solem 16 éve
szülő
commit
e6778be0de
2 módosított fájl, 7 hozzáadás és 3 törlés
  1. 1 1
      celery/bin/celeryd.py
  2. 6 2
      celery/worker/controllers.py

+ 1 - 1
celery/bin/celeryd.py

@@ -171,7 +171,7 @@ def acquire_pidlock(pidfile):
     except os.error, exc:
         if exc.errno == errno.ESRCH:
             sys.stderr.write("Stale pidfile exists. Removing it.\n")
-            pidlock.release()
+            os.unlink(pidfile)
             return PIDLockFile(pidfile)
     else:
         raise SystemExit(

+ 6 - 2
celery/worker/controllers.py

@@ -21,8 +21,12 @@ class Mediator(threading.Thread):
             if self._shutdown.isSet():
                 break
             # This blocks until there's a message in the queue.
-            task = self.bucket_queue.get()
-            self.callback(task)
+            try:
+                task = self.bucket_queue.get(timeout=1)
+            except QueueEmpty:
+                pass
+            else:
+                self.callback(task)
         self._stopped.set() # indicate that we are stopped
 
     def stop(self):