[OVN] Change `PeriodicWorker executor to ThreadPoolExecutor`
The default executor factory for the ``periodics.PeriodicWorker`` instance is ``futurist.SynchronousExecutor``. That creates a caller that is executed synchronously with the current thread. The ``futurist.ThreadPoolExecutor`` instead creates a new thread pool to execute the calls asynchronously. Now eventlet is removed from the Neutron API and kernel threads are using, this executor will be more accurate when calling the periodic methods. Closes-Bug: #2097257 Change-Id: Ie01fd776856463593e016a0a22a29cb5666ea896
This commit is contained in:
committed by
Rodolfo Alonso
parent
b739f624a0
commit
d98d028527
@@ -18,6 +18,7 @@ import functools
|
||||
import inspect
|
||||
import threading
|
||||
|
||||
import futurist
|
||||
from futurist import periodics
|
||||
from neutron_lib.api.definitions import external_net
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
@@ -96,7 +97,9 @@ class MaintenanceThread:
|
||||
|
||||
def start(self):
|
||||
if self._thread is None:
|
||||
self._worker = periodics.PeriodicWorker(self._callables)
|
||||
self._worker = periodics.PeriodicWorker(
|
||||
self._callables,
|
||||
executor_factory=futurist.ThreadPoolExecutor)
|
||||
self._thread = threading.Thread(target=self._worker.start)
|
||||
self._thread.daemon = True
|
||||
self._thread.start()
|
||||
|
||||
Reference in New Issue
Block a user