From ea50365cce1c5c29a8336afcc6366022b7c6d520 Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Tue, 27 May 2025 15:31:11 +0200 Subject: [PATCH] Do not yield in threading mode If a service runs in threading mode nova.utils.cooperative_yield is noop as yielding is only necessary for eventlet. Change-Id: I72a52262f5c501f77d23ed56cbcd1a9c2be72fa7 Signed-off-by: Balazs Gibizer --- nova/utils.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nova/utils.py b/nova/utils.py index 014748a02c..38fdd79fef 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -80,13 +80,12 @@ _SERVICE_TYPES = service_types.ServiceTypes() DEFAULT_EXECUTOR = None -# TODO(ksambor) Make this a no-op in threading mode once a -# threading-compatible service is available.Also, remove all -# cooperative_yield calls after dropping Eventlet support. - def cooperative_yield(): - time.sleep(0) + # TODO(ksambor) Remove all cooperative_yield calls after dropping Eventlet + # support. + if not concurrency_mode_threading(): + time.sleep(0) def destroy_default_executor():