]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Make L3 agent honor periodic_interval setting
authorKevin Benton <blak111@gmail.com>
Thu, 15 Jan 2015 16:11:49 +0000 (08:11 -0800)
committerKevin Benton <blak111@gmail.com>
Sat, 28 Mar 2015 20:10:21 +0000 (13:10 -0700)
The periodic_task decorator for the sync routers task was resulting
in a default spacing of 60 seconds. This meant that any values less
than that for the periodic_interval setting would not work correctly.
The fixed interval looping call would run at the periodic_interval
but this task would not execute every time as expected.

For example, if the periodic_interval was 40 seconds, the task would
only end up running every other interval (80 seconds in this case)
because every other attempt would be blocked by the default 60 second
barrier of periodic_task.

This sets the periodic_taks spacing variable to 1 second so the
interval is controlled only by the loopingcall as expected.

Ultimately periodic_task should probably be completely removed since
it's not compatible with the fixed interval loopingcall in this manner.

Closes-Bug: #1411085
Change-Id: I23818c3fab2640b241692f00f9b5a2f923e3cf31

neutron/agent/l3/agent.py

index 3c754d46e957220222bae81543f73fd90db2adc6..99d3cf102d545596870689a449c7ef808585fbee 100644 (file)
@@ -475,7 +475,10 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
         while True:
             pool.spawn_n(self._process_router_update)
 
-    @periodic_task.periodic_task
+    # NOTE(kevinbenton): this is set to 1 second because the actual interval
+    # is controlled by a FixedIntervalLoopingCall in neutron/service.py that
+    # is responsible for task execution.
+    @periodic_task.periodic_task(spacing=1)
     def periodic_sync_routers_task(self, context):
         self.process_services_sync(context)
         LOG.debug("Starting periodic_sync_routers_task - fullsync:%s",