forked from kate/uniborg
Be more careful when unloading plugin
This commit is contained in:
parent
c8b5179cb5
commit
febe3c4bac
|
@ -82,9 +82,12 @@ class Uniborg(TelegramClient):
|
||||||
|
|
||||||
plugin = self._plugins.pop(shortname)
|
plugin = self._plugins.pop(shortname)
|
||||||
if callable(getattr(plugin, 'unload', None)):
|
if callable(getattr(plugin, 'unload', None)):
|
||||||
unload = plugin.unload()
|
try:
|
||||||
if inspect.isawaitable(unload):
|
unload = plugin.unload()
|
||||||
await unload
|
if inspect.isawaitable(unload):
|
||||||
|
await unload
|
||||||
|
except Exception:
|
||||||
|
self._logger.exception(f'Unhandled exception unloading {shortname}')
|
||||||
|
|
||||||
del plugin
|
del plugin
|
||||||
self._logger.info(f"Removed plugin {shortname}")
|
self._logger.info(f"Removed plugin {shortname}")
|
||||||
|
|
Loading…
Reference in New Issue