Ask Solem 15 years ago
parent
commit
6a6542c1f3
1 changed files with 11 additions and 11 deletions
  1. 11 11
      celery/managers.py

+ 11 - 11
celery/managers.py

@@ -12,10 +12,11 @@ class TaskManager(models.Manager):
     def get_task(self, task_id, exception_retry_count=1):
         """Get task meta for task by ``task_id``.
 
-        :keyword exception_retry_count: How many times to retry with
-            transaction rollback on exception. 1 by default: we assume
-            the pessimistic case when we get race condition in which
-            task is created by other process during get_or_create
+        :keyword exception_retry_count: How many times to retry by
+            transaction rollback on exception. This could theoretically
+            happen in a race condition if another worker is trying to
+            create the same task. The default is to retry once.
+
         """
         try:
             task, created = self.get_or_create(task_id=task_id)
@@ -24,7 +25,7 @@ class TaskManager(models.Manager):
             # throw, so we have to catch everything.
             if exception_retry_count > 0:
                 transaction.rollback_unless_managed()
-                return self.get_task(task_id, exception_retry_count-1)
+                return self.get_task(task_id, exception_retry_count - 1)
             else:
                 raise
         return task
@@ -57,12 +58,11 @@ class TaskManager(models.Manager):
         :keyword traceback: The traceback at the point of exception (if the
             task failed).
 
-        :keyword exception_retry_count: How many times to retry with
-            transaction rollback on exception. 2 by default: we assume
-            the pessimistic case when task execution by itself could
-            leave broken transaction, and during second try we get
-            race condition in which task is created by other process
-            during get_or_create
+        :keyword exception_retry_count: How many times to retry by
+            transaction rollback on exception. This could theoretically
+            happen in a race condition if another worker is trying to
+            create the same task. The default is to retry twice.
+
         """
         try:
             task, created = self.get_or_create(task_id=task_id, defaults={