From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Zac Medico <zmedico@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH v2] Use default asyncio event loop implementation in API consumer threads
Date: Sun, 6 Dec 2020 13:38:13 -0800 [thread overview]
Message-ID: <20201206213813.1110780-1-zmedico@gentoo.org> (raw)
In-Reply-To: <20201206094626.1032508-1-zmedico@gentoo.org>
Make the _safe_loop function return an AsyncioEventLoop instance,
so that the default asyncio event loop implementation will be used
in API consumer threads. This is possible because the underlying
asyncio.get_event_loop() function returns a new event loop for
each thread.
Bug: https://bugs.gentoo.org/758755
Signed-off-by: Zac Medico <zmedico@gentoo.org>
---
[PATCH v2] fixed _safe_loop function to return a new
AsyncioEventLoop per thread
lib/portage/util/futures/_asyncio/__init__.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/portage/util/futures/_asyncio/__init__.py b/lib/portage/util/futures/_asyncio/__init__.py
index a902ad895..12013be00 100644
--- a/lib/portage/util/futures/_asyncio/__init__.py
+++ b/lib/portage/util/futures/_asyncio/__init__.py
@@ -34,7 +34,6 @@ import portage
portage.proxy.lazyimport.lazyimport(globals(),
'portage.util.futures.unix_events:_PortageEventLoopPolicy',
'portage.util.futures:compat_coroutine@_compat_coroutine',
- 'portage.util._eventloop.EventLoop:EventLoop@_EventLoop',
)
from portage.util._eventloop.asyncio_event_loop import AsyncioEventLoop as _AsyncioEventLoop
from portage.util._eventloop.global_event_loop import (
@@ -256,4 +255,4 @@ def _safe_loop():
"""
if portage._internal_caller:
return _global_event_loop()
- return _EventLoop(main=False)
+ return _AsyncioEventLoop()
--
2.26.2
next prev parent reply other threads:[~2020-12-06 21:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-06 8:59 [gentoo-portage-dev] [PATCH] Use default asyncio event loop implementation in child processes Zac Medico
2020-12-06 9:46 ` [gentoo-portage-dev] [PATCH] Use default asyncio event loop implementation in API consumer threads Zac Medico
2020-12-06 11:38 ` [gentoo-portage-dev] " Zac Medico
2020-12-06 21:38 ` Zac Medico [this message]
2020-12-06 22:14 ` [gentoo-portage-dev] [PATCH v3] " Zac Medico
2020-12-06 23:15 ` [gentoo-portage-dev] " Zac Medico
2020-12-06 23:19 ` Zac Medico
2020-12-07 0:18 ` [gentoo-portage-dev] [PATCH v4] " Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201206213813.1110780-1-zmedico@gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox