Run worker-based engine tests faster
This change reduces polling intervals for transport and proxy from default 1 second to 0.01 second. On my machine this reduces time needed to run WorkerBasedEngineTest almost 5 times, which, in turn, makes testr almost twice faster. Change-Id: I8dfe08c06234f33e838059b2f8d9d6a7c7819e06
This commit is contained in:
@@ -44,6 +44,12 @@ class Proxy(object):
|
||||
self._transport = kwargs.get('transport')
|
||||
self._transport_opts = kwargs.get('transport_options')
|
||||
|
||||
self._drain_events_timeout = DRAIN_EVENTS_PERIOD
|
||||
if self._transport == 'memory' and self._transport_opts:
|
||||
polling_interval = self._transport_opts.get('polling_interval')
|
||||
if polling_interval:
|
||||
self._drain_events_timeout = polling_interval
|
||||
|
||||
# create connection
|
||||
self._conn = kombu.Connection(self._url, transport=self._transport,
|
||||
transport_options=self._transport_opts)
|
||||
@@ -95,7 +101,7 @@ class Proxy(object):
|
||||
self._running.set()
|
||||
while self.is_running:
|
||||
try:
|
||||
conn.drain_events(timeout=DRAIN_EVENTS_PERIOD)
|
||||
conn.drain_events(timeout=self._drain_events_timeout)
|
||||
except socket.timeout:
|
||||
pass
|
||||
if self._on_wait is not None:
|
||||
|
||||
@@ -587,6 +587,9 @@ class WorkerBasedEngineTest(EngineTaskTest,
|
||||
'taskflow.tests.utils',
|
||||
],
|
||||
'transport': self.transport,
|
||||
'transport_options': {
|
||||
'polling_interval': 0.01
|
||||
}
|
||||
}
|
||||
self.worker = wkr.Worker(**worker_conf)
|
||||
self.worker_thread = threading.Thread(target=self.worker.run)
|
||||
|
||||
Reference in New Issue
Block a user