forked from uniborg/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)
|
||||
if callable(getattr(plugin, 'unload', None)):
|
||||
try:
|
||||
unload = plugin.unload()
|
||||
if inspect.isawaitable(unload):
|
||||
await unload
|
||||
except Exception:
|
||||
self._logger.exception(f'Unhandled exception unloading {shortname}')
|
||||
|
||||
del plugin
|
||||
self._logger.info(f"Removed plugin {shortname}")
|
||||
|
|
Loading…
Reference in New Issue