]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Make the alarm actions run in one thread
authorAngus Salkeld <asalkeld@redhat.com>
Mon, 25 Feb 2013 22:16:12 +0000 (09:16 +1100)
committerAngus Salkeld <asalkeld@redhat.com>
Mon, 25 Feb 2013 22:16:12 +0000 (09:16 +1100)
bug #1131024
Change-Id: I678d8919a17fc73350ec9061ad2a7234e1d6b9f6

heat/engine/service.py

index 78d10d054f468ba9bfdcf69924da11dce5ec32b6..8806dfb4dfd6f07b808667a72e48ad9dc048ee49 100644 (file)
@@ -28,7 +28,6 @@ from heat.common import exception
 from heat.common import identifier
 from heat.engine import parser
 from heat.engine import resource
-from heat.engine import resources
 from heat.engine import watchrule
 
 from heat.openstack.common import log as logging
@@ -513,11 +512,16 @@ class EngineService(service.Service):
             logger.warn('periodic_task db error (%s) %s' %
                         ('watch rule removed?', str(ex)))
             return
+
+        def run_alarm_action(actions):
+            for action in actions:
+                action()
+
         for wr in wrs:
             rule = watchrule.WatchRule.load(stack_context, watch=wr)
             actions = rule.evaluate()
-            for action in actions:
-                self._start_in_thread(sid, action)
+            if actions:
+                self._start_in_thread(sid, run_alarm_action, actions)
 
     @request_context
     def create_watch_data(self, context, watch_name, stats_data):