Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH v2] Use default asyncio event loop implementation in API consumer threads
Date: Sun, 06 Dec 2020 21:40:28
Message-Id: 20201206213813.1110780-1-zmedico@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] Use default asyncio event loop implementation in API consumer threads by Zac Medico
1 Make the _safe_loop function return an AsyncioEventLoop instance,
2 so that the default asyncio event loop implementation will be used
3 in API consumer threads. This is possible because the underlying
4 asyncio.get_event_loop() function returns a new event loop for
5 each thread.
6
7 Bug: https://bugs.gentoo.org/758755
8 Signed-off-by: Zac Medico <zmedico@g.o>
9 ---
10 [PATCH v2] fixed _safe_loop function to return a new
11 AsyncioEventLoop per thread
12
13 lib/portage/util/futures/_asyncio/__init__.py | 3 +--
14 1 file changed, 1 insertion(+), 2 deletions(-)
15
16 diff --git a/lib/portage/util/futures/_asyncio/__init__.py b/lib/portage/util/futures/_asyncio/__init__.py
17 index a902ad895..12013be00 100644
18 --- a/lib/portage/util/futures/_asyncio/__init__.py
19 +++ b/lib/portage/util/futures/_asyncio/__init__.py
20 @@ -34,7 +34,6 @@ import portage
21 portage.proxy.lazyimport.lazyimport(globals(),
22 'portage.util.futures.unix_events:_PortageEventLoopPolicy',
23 'portage.util.futures:compat_coroutine@_compat_coroutine',
24 - 'portage.util._eventloop.EventLoop:EventLoop@_EventLoop',
25 )
26 from portage.util._eventloop.asyncio_event_loop import AsyncioEventLoop as _AsyncioEventLoop
27 from portage.util._eventloop.global_event_loop import (
28 @@ -256,4 +255,4 @@ def _safe_loop():
29 """
30 if portage._internal_caller:
31 return _global_event_loop()
32 - return _EventLoop(main=False)
33 + return _AsyncioEventLoop()
34 --
35 2.26.2