diff pylons_app/lib/celerylib/tasks.py @ 504:d280aa1c85c6

removed pidlock from whoosh and added it as locked_task decorator
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 25 Sep 2010 20:17:56 +0200
parents ac32a026c306
children d5efb83590ef
line wrap: on
line diff
--- a/pylons_app/lib/celerylib/tasks.py	Fri Sep 24 18:13:29 2010 +0200
+++ b/pylons_app/lib/celerylib/tasks.py	Sat Sep 25 20:17:56 2010 +0200
@@ -66,20 +66,11 @@
     return settings   
 
 @task
+@locked_task
 def whoosh_index(repo_location, full_index):
     log = whoosh_index.get_logger()
-    from pylons_app.lib.pidlock import DaemonLock
-    from pylons_app.lib.indexers.daemon import WhooshIndexingDaemon, LockHeld
-    try:
-        l = DaemonLock()
-        WhooshIndexingDaemon(repo_location=repo_location)\
-            .run(full_index=full_index)
-        l.release()
-        return 'Done'
-    except LockHeld:
-        log.info('LockHeld')
-        return 'LockHeld'    
-
+    from pylons_app.lib.indexers.daemon import WhooshIndexingDaemon
+    WhooshIndexingDaemon(repo_location=repo_location).run(full_index=full_index)
 
 @task
 @locked_task