Use ThreadGroup.add_timer() API correctly

In practice we never pass any arguments to the callback function, but if
we did we'd be doing it wrong. Multiple projects appear to have copied
this code from us (directly or indirectly). Fix it before we lead anyone
else astray.

Change-Id: If9cddc470158f32587b2aac19e92d1e01b48bc50
This commit is contained in:
Zane Bitter 2018-12-06 16:36:08 +13:00
parent 0b83b05115
commit de09e60407
2 changed files with 2 additions and 2 deletions

View File

@ -219,7 +219,7 @@ class ThreadGroupManager(object):
if stack_id not in self.groups:
self.groups[stack_id] = threadgroup.ThreadGroup()
self.groups[stack_id].add_timer(cfg.CONF.periodic_interval,
func, *args, **kwargs)
func, None, *args, **kwargs)
def add_msg_queue(self, stack_id, msg_queue):
self.msg_queues[stack_id].append(msg_queue)

View File

@ -76,7 +76,7 @@ class ThreadGroupManagerTest(common.HeatTestCase):
self.assertEqual(self.tg_mock, thm.groups[stack_id])
self.tg_mock.add_timer.assert_called_with(
self.cfg_mock.CONF.periodic_interval,
self.f, *self.fargs, **self.fkwargs)
self.f, None, *self.fargs, **self.fkwargs)
def test_tgm_add_msg_queue(self):
stack_id = 'add_msg_queues_test'