Blame SOURCES/long_delay_1379479.patch

73b831
From 0a21382a7e76ce06bd484add725be3c5e41b216a Mon Sep 17 00:00:00 2001
73b831
From: Martin Kolman <mkolman@redhat.com>
73b831
Date: Thu, 23 Feb 2017 15:07:57 +0100
73b831
Subject: [PATCH] Use the init_done signal instead of wait_all() (#1380224)
73b831
73b831
Using the wait_all() function provided by the Anaconda thread manager
73b831
singleton can result in unexpected behavior, as there might still be
73b831
threads unrelated to spoke initialization still running when the
73b831
function is called. This might result in unnecessary delay before the
73b831
OSCAP addon spoke becomes ready and installation can continue.
73b831
73b831
So use the init_done signal, which is the proper way to wait for
73b831
Anaconda spokes to finish initialization.
73b831
73b831
Also bump the Anaconda version to one that provides the init_done
73b831
signal.
73b831
73b831
Resolves: rhbz#1380224
73b831
---
73b831
 org_fedora_oscap/gui/spokes/oscap.py | 14 +++++++++++++-
73b831
73b831
diff --git a/org_fedora_oscap/gui/spokes/oscap.py b/org_fedora_oscap/gui/spokes/oscap.py
73b831
index 35f7a75..b476cf9 100644
73b831
--- a/org_fedora_oscap/gui/spokes/oscap.py
73b831
+++ b/org_fedora_oscap/gui/spokes/oscap.py
73b831
@@ -214,6 +214,14 @@ def __init__(self, data, storage, payload, instclass):
73b831
 
73b831
         self._error = None
73b831
 
73b831
+        # wait for all Anaconda spokes to initialiuze
73b831
+        self._anaconda_spokes_initialized = threading.Event()
73b831
+        self.initialization_controller.init_done.connect(self._all_anaconda_spokes_initialized)
73b831
+
73b831
+    def _all_anaconda_spokes_initialized(self):
73b831
+        log.debug("OSCAP addon: Anaconda init_done signal triggered")
73b831
+        self._anaconda_spokes_initialized.set()
73b831
+
73b831
     def initialize(self):
73b831
         """
73b831
         The initialize method that is called after the instance is created.
73b831
@@ -431,7 +439,11 @@ def _init_after_data_fetch(self, wait_for):
73b831
 
73b831
         # let all initialization and configuration happen before we evaluate the
73b831
         # setup
73b831
-        threadMgr.wait_all()
73b831
+        if not self._anaconda_spokes_initialized.is_set():
73b831
+            # only wait (and log the messages) if the event is not set yet
73b831
+            log.debug("OSCAP addon: waiting for all Anaconda spokes to be initialized")
73b831
+            self._anaconda_spokes_initialized.wait()
73b831
+            log.debug("OSCAP addon: all Anaconda spokes have been initialized - continuing")
73b831
 
73b831
         # try to switch to the chosen profile (if any)
73b831
         selected = self._switch_profile()
73b831