From ef5a98595ec647198f3d06375d2c1d4a5a54bf02 Mon Sep 17 00:00:00 2001 From: Numerlor <25886452+Numerlor@users.noreply.github.com> Date: Wed, 3 Feb 2021 12:07:13 +0100 Subject: Move BeautifulSoup parsing into an executor --- bot/exts/info/doc/_batch_parser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot/exts/info/doc/_batch_parser.py b/bot/exts/info/doc/_batch_parser.py index c16cf6d28..13e197587 100644 --- a/bot/exts/info/doc/_batch_parser.py +++ b/bot/exts/info/doc/_batch_parser.py @@ -111,7 +111,10 @@ class BatchParser: self._item_futures[doc_item].user_requested = True async with bot.instance.http_session.get(doc_item.url) as response: - soup = BeautifulSoup(await response.text(encoding="utf8"), "lxml") + soup = await bot.instance.loop.run_in_executor( + None, + partial(BeautifulSoup, await response.text(encoding="utf8"), "lxml") + ) self._queue.extend(QueueItem(item, soup) for item in self._page_doc_items[doc_item.url]) log.debug(f"Added items from {doc_item.url} to parse queue.") -- cgit v1.2.3