Fix: Removed use of private exception classes

removed referenfces to:
- concurrent.futures._base.CancelledError
- asyncio.exceptions.CancelledError
This commit is contained in:
Jylpah committed 2021-01-18 09:23:41 +02:00
1 parent c9745fcf5c
commit 3e27bd995e
2 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -1408,7 +1408,7 @@ async def main(argv):
bu.error(exception=err) bu.error(exception=err)
except UserWarning as err: except UserWarning as err:
bu.warning(str(err)) bu.warning(str(err))
except asyncio.exceptions.CancelledError: except asyncio.CancelledError:
pass pass
except Exception as err: except Exception as err:
bu.error(exception=err) bu.error(exception=err)
@@ -1798,7 +1798,7 @@ async def stat_worker(queue : asyncio.Queue, workerID: int, args : argparse.Name
bu.error('Unexpected error', err, id=workerID) bu.error('Unexpected error', err, id=workerID)
queue.task_done() queue.task_done()
except (asyncio.CancelledError, concurrent.futures._base.CancelledError): except (asyncio.CancelledError, concurrent.futures.CancelledError):
bu.debug('Stats queue is empty', id=workerID) bu.debug('Stats queue is empty', id=workerID)
except Exception as err: except Exception as err:
bu.error(exception=err, id=workerID) bu.error(exception=err, id=workerID)
+3 -3
View File
@@ -103,7 +103,7 @@ class ThrottledClientSession(aiohttp.ClientSession):
if self._fillerTask != None: if self._fillerTask != None:
self._fillerTask.cancel() self._fillerTask.cancel()
await asyncio.wait_for(self._fillerTask, timeout= 0.5) await asyncio.wait_for(self._fillerTask, timeout= 0.5)
except (asyncio.exceptions.CancelledError, asyncio.TimeoutError): except (asyncio.CancelledError, asyncio.TimeoutError):
pass pass
await super().close() await super().close()
@@ -147,7 +147,7 @@ class ThrottledClientSession(aiohttp.ClientSession):
self._queue.put_nowait(i) self._queue.put_nowait(i)
updated_at = now updated_at = now
await asyncio.sleep(sleep) await asyncio.sleep(sleep)
except (asyncio.exceptions.CancelledError, asyncio.CancelledError): except asyncio.CancelledError:
debug('Cancelled') debug('Cancelled')
except Exception as err: except Exception as err:
error(exception=err) error(exception=err)
@@ -1474,7 +1474,7 @@ class WG:
else: else:
error('Function to saves stats type \'' + stats_type + '\' is not implemented yet') error('Function to saves stats type \'' + stats_type + '\' is not implemented yet')
except (asyncio.CancelledError): except asyncio.CancelledError:
# this is an eternal loop that will wait until cancelled # this is an eternal loop that will wait until cancelled
return None return None