Pārlūkot izejas kodu

Wrap timer_stat.stop() in a finally block.

Ask Solem 16 gadi atpakaļ
vecāks
revīzija
19c5f706b2
2 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 0 1
      celery/monitoring.py
  2. 2 1
      celery/worker.py

+ 0 - 1
celery/monitoring.py

@@ -204,7 +204,6 @@ class StatsCollector(object):
             * Total number of tasks executed.
         
         """
-        print("-" * 64)
         print("Total processing time by task type:")
         for task_name, nsecs in self.total_task_time_running_by_type.items():
             print("\t%s: %s secs. (for a total of %d executed.)" % (

+ 2 - 1
celery/worker.py

@@ -106,8 +106,9 @@ def jail(task_id, task_name, func, args, kwargs):
     else:
         default_backend.mark_as_done(task_id, result)
         retval = result
+    finally:
+        timer_stat.stop()
 
-    timer_stat.stop()
     return retval