Skip to content

Commit f827ba7

Browse files
committed
Updater: Enable qubesadmin caching
This avoids O(N^2) Admin API calls. Hopefully, this Fixes: QubesOS/qubes-issues#10775 Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
1 parent d56bb9e commit f827ba7

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

qui/updater/updater.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -*- coding: utf-8 -*-
33
# pylint: disable=wrong-import-position,import-error
44
import argparse
5+
import asyncio
56
import logging
67
import sys
78
import time
@@ -23,7 +24,18 @@
2324

2425
gi.require_version("Gtk", "3.0") # isort:skip
2526
from gi.repository import Gtk, Gdk, Gio # isort:skip
27+
28+
try:
29+
from gi.events import GLibEventLoopPolicy
30+
31+
asyncio.set_event_loop_policy(GLibEventLoopPolicy())
32+
except ImportError:
33+
import gbulb
34+
35+
gbulb.install()
36+
2637
from qubesadmin import Qubes
38+
import qubesadmin.events
2739
import qubesadmin.exc
2840

2941
# using locale.gettext is necessary for Gtk.Builder translation support to work
@@ -64,6 +76,8 @@ def __init__(self, qapp, cliargs):
6476
self.log = logging.getLogger("vm-update.agent.PackageManager")
6577
self.log.addHandler(log_handler)
6678
self.log.setLevel(self.cliargs.log)
79+
dispatcher = qubesadmin.events.EventsDispatcher(qapp)
80+
asyncio.ensure_future(dispatcher.listen_for_events())
6781

6882
def do_activate(self, *_args, **_kwargs):
6983
if not self.primary:

0 commit comments

Comments
 (0)