diff options
author | 2021-03-05 02:09:14 +0100 | |
---|---|---|
committer | 2021-03-05 02:46:41 +0100 | |
commit | 3d4df68eb875a0e7042be387bb50561b917d1e40 (patch) | |
tree | bf190ab42d3eb7a307804ed9d08a85b21abe23c6 | |
parent | Rename params to clearer and more concise alternatives (diff) |
Move future assignment and check outside of the try
No exceptions can be raised from the two lines of code because of the
data structures used, moving it out makes for flatter code.
-rw-r--r-- | bot/exts/info/doc/_batch_parser.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/bot/exts/info/doc/_batch_parser.py b/bot/exts/info/doc/_batch_parser.py index d80b62d88..a626008d2 100644 --- a/bot/exts/info/doc/_batch_parser.py +++ b/bot/exts/info/doc/_batch_parser.py @@ -129,12 +129,13 @@ class BatchParser: while self._queue: item, soup = self._queue.pop() markdown = None - try: - if (future := self._item_futures[item]).done(): - # Some items are present in the inventories multiple times under different symbol names, - # if we already parsed an equal item, we can just skip it. - continue + if (future := self._item_futures[item]).done(): + # Some items are present in the inventories multiple times under different symbol names, + # if we already parsed an equal item, we can just skip it. + continue + + try: markdown = await bot.instance.loop.run_in_executor(None, get_symbol_markdown, soup, item) if markdown is not None: await doc_cache.set(item, markdown) |