diff options
author | Brian C. Lane <bcl@redhat.com> | 2012-06-12 17:29:00 -0700 |
---|---|---|
committer | Brian C. Lane <bcl@redhat.com> | 2012-06-13 09:05:06 -0700 |
commit | c3c891b18b87d9ed721fa20f9e186692c09a1019 (patch) | |
tree | 5c9efa198fd117cb8ddfae03d16579789f828a60 /pyanaconda/ui/gui/hubs | |
parent | 5f847d4e8c08c7d1311357a44a4609b597698191 (diff) | |
download | anaconda-c3c891b18b87d9ed721fa20f9e186692c09a1019.tar.gz anaconda-c3c891b18b87d9ed721fa20f9e186692c09a1019.tar.xz anaconda-c3c891b18b87d9ed721fa20f9e186692c09a1019.zip |
use timeout instead of idle for Queue polling
The Queue poll inside the GLib idle state was causing 100% CPU usage, it
was being called multiple times per second. It would be more efficient
to be able to use a select() or poll() with the Queue, but that isn't
possible. So, run the Queue processing in a 1 second timeout. CPU usage
drops to almost nothing.
Also add a call to q.task_done() for unrecognized messages.
Diffstat (limited to 'pyanaconda/ui/gui/hubs')
-rw-r--r-- | pyanaconda/ui/gui/hubs/__init__.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py index 498f6dcd7..40cc6efdf 100644 --- a/pyanaconda/ui/gui/hubs/__init__.py +++ b/pyanaconda/ui/gui/hubs/__init__.py @@ -229,6 +229,7 @@ class Hub(UIObject): # acting on. If no such spoke exists, throw the message away. spoke = self._spokes.get(args[0], None) if not spoke: + q.task_done() continue if code in [communication.HUB_CODE_READY, communication.HUB_CODE_NOT_READY]: @@ -251,7 +252,7 @@ class Hub(UIObject): UIObject.refresh(self) self._createBox() - self._update_spoke_id = GLib.idle_add(self._update_spokes) + self._update_spoke_id = GLib.timeout_add_seconds(1, self._update_spokes) ### SIGNAL HANDLERS |