updater: full migration to asyncio#322
Conversation
- replace threads with asyncio loop to enable reliable event handling, - consolidate event-loop access to a single call in main() The loop cannot be dropped entirely: it must be the one consistent with GApplication. It's a best effort solution to make an eventual migration to newer version easier. - move blocking Admin API calls (VM start/shutdown) to an executor to prevent UI and loading spinners from freezing, - eliminate nested modal GTK loops (dialog.run()), replacing them with async dialogs, - re-enable qubesadmin caching and tied the `EventsDispatcher` listener directly to the active async loop to have real-time cache invalidation, - close window button closes the updater just after updates, - adapt tests to coroutines.
This is an artifact of gi.events (the update itself has already finished) and cannot be fixed cleanly without patching gi.events.
|
For shutdown handling specifically, take a look at https://github.com/QubesOS/qubes-desktop-linux-manager/pull/312/changes |
19c1a8a to
a4dd919
Compare
| ``asyncio.run()`` fails (it tries to set a new loop on the main thread's | ||
| context). | ||
| """ | ||
| loop = asyncio.SelectorEventLoop() |
There was a problem hiding this comment.
Is this really a good idea? Isn't it better to simply take that created loop (asyncio.get_event_loop())?
There was a problem hiding this comment.
I focused here on maximum isolation in unit tests, but maybe it would actually be better to increase integration with the working environment
OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2026072219-devel&flavor=pull-requests Test run included the following:
New failures, excluding unstableCompared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2026050504-devel&flavor=update
Failed tests14 failures
Fixed failuresCompared to: https://openqa.qubes-os.org/tests/176874#dependencies 27 fixed
Unstable testsDetails
Performance TestsPerformance degradation:42 performance degradations
Remaining performance tests:69 tests
|
Inspiration was /pull/320
While searching for a solution, I went deeper and ended up with a major refactor.
First commit:
The loop cannot be dropped entirely: it must be the one consistent with GApplication.
It's a best effort solution to make an eventual migration to newer version easier.
EventsDispatcherlistener directly to the active async loop to have real-time cache invalidation,The following commits fix smaller issues loosely related to main subject.
fix QubesOS/qubes-issues/issues/10947