[producer] Do not hard stop periodic task during exception
Use add_timer_args with stop_on_exception=False to avoid hard stop of periodic task during exception. Closes-Bug: #2064574 Change-Id: If5cb6ddcac114addc99f0e025d517b010a3ec739
This commit is contained in:
parent
b26b3aff50
commit
b65d7c1341
designate
@ -120,9 +120,10 @@ class Coordination:
|
||||
|
||||
def _enable_grouping(self):
|
||||
self._create_group()
|
||||
self.tg.add_timer(
|
||||
self.tg.add_timer_args(
|
||||
CONF.coordination.run_watchers_interval,
|
||||
self._coordinator_run_watchers
|
||||
self._coordinator_run_watchers,
|
||||
stop_on_exception=False,
|
||||
)
|
||||
|
||||
|
||||
|
@ -88,7 +88,7 @@ class Service(service.RPCService):
|
||||
self._partitioner.watch_partition_change(task.on_partition_change)
|
||||
|
||||
interval = CONF[task.get_canonical_name()].interval
|
||||
self.tg.add_timer(interval, task)
|
||||
self.tg.add_timer_args(interval, task, stop_on_exception=False)
|
||||
|
||||
def stop(self, graceful=True):
|
||||
super().stop(graceful)
|
||||
|
@ -73,8 +73,8 @@ class ProducerServiceTest(oslotest.base.BaseTestCase):
|
||||
mock_partition.start.assert_called()
|
||||
|
||||
# Make sure that tasks were added to the tg timer.
|
||||
self.tg.add_timer.assert_called()
|
||||
self.assertEqual(6, self.tg.add_timer.call_count)
|
||||
self.tg.add_timer_args.assert_called()
|
||||
self.assertEqual(6, self.tg.add_timer_args.call_count)
|
||||
|
||||
@mock.patch.object(service.coordination, 'Partitioner')
|
||||
@mock.patch.object(designate.service.RPCService, 'start')
|
||||
|
Loading…
x
Reference in New Issue
Block a user