From ec6578294ffd45895a2021174d38d9f8dc2c44a1 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 16 Apr 2019 16:33:19 +0300 Subject: [PATCH] Clear plugin webapp routes in default stop() --- maubot/__init__.py | 1 + maubot/plugin_base.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/maubot/__init__.py b/maubot/__init__.py index 3e2ffac..9ca0322 100644 --- a/maubot/__init__.py +++ b/maubot/__init__.py @@ -1,2 +1,3 @@ from .plugin_base import Plugin +from .plugin_server import PluginWebApp from .matrix import MaubotMatrixClient as Client, MaubotMessageEvent as MessageEvent diff --git a/maubot/plugin_base.py b/maubot/plugin_base.py index 47ae7b4..eb49818 100644 --- a/maubot/plugin_base.py +++ b/maubot/plugin_base.py @@ -62,6 +62,8 @@ class Plugin(ABC): async def stop(self) -> None: for func, event_type in self._handlers_at_startup: self.client.remove_event_handler(event_type, func) + if self.webapp: + self.webapp.clear() @classmethod def get_config_class(cls) -> Optional[Type['BaseProxyConfig']]: