Better exception management in AsyncRunnablePlugin.

Exceptions that cause the termination of the plugin's loop should always
be logged as such, unless the plugin is supposed to stop and various
exceptions may occur upon teardown.
This commit is contained in:
Fabio Manganiello 2023-02-19 23:03:27 +01:00
parent a6c36fa1c1
commit 9112239ac3
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -212,7 +212,9 @@ class AsyncRunnablePlugin(RunnablePlugin, ABC):
try: try:
self._loop.run_until_complete(self._task) self._loop.run_until_complete(self._task)
except Exception as e: except Exception as e:
self.logger.info('The loop has terminated with an error: %s', e) if not self.should_stop():
self.logger.warning('The loop has terminated with an error')
self.logger.exception(e)
self._task.cancel() self._task.cancel()