Use ThreadGroup.add_timer() API correctly

Nothing is calling add_timer with arguments to the callback function,
but if it did they would be passed incorrectly.

Change-Id: I92cdab66d1c826a24aef473946e9cc0346296e3b
This commit is contained in:
Zane Bitter 2018-12-06 16:44:25 +13:00
parent 8f340b2e0e
commit fb888e3fa9
2 changed files with 3 additions and 2 deletions

View File

@ -158,7 +158,7 @@ class ThreadGroupManager(object):
The task will be executed in a separate green thread.
Interval is from cfg.CONF.periodic_interval
"""
timer = self.group.add_timer(interval, func, *args, **kwargs)
timer = self.group.add_timer(interval, func, None, *args, **kwargs)
return timer
def stop_timers(self):

View File

@ -70,7 +70,8 @@ class SchedulerTest(base.SenlinTestCase):
tgm = scheduler.ThreadGroupManager()
mock_group.add_timer.assert_called_once_with(
cfg.CONF.periodic_interval,
tgm._service_task)
tgm._service_task,
None)
def test_start(self):
def f():