app: resolve soft restart issues
Clear the API cache when closing to purge stale callbacks. In addition, explicitly delte the server object after the eventloop stops. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
c4d15e40a8
commit
5585884d26
|
@ -307,6 +307,7 @@ class MoonrakerApp:
|
|||
if self.secure_server is not None:
|
||||
self.secure_server.stop()
|
||||
await self.secure_server.close_all_connections()
|
||||
APIDefinition.reset_cache()
|
||||
|
||||
def register_endpoint(
|
||||
self,
|
||||
|
|
|
@ -265,6 +265,10 @@ class APIDefinition:
|
|||
def get_cache(cls) -> Dict[str, APIDefinition]:
|
||||
return cls._cache
|
||||
|
||||
@classmethod
|
||||
def reset_cache(cls) -> None:
|
||||
cls._cache.clear()
|
||||
|
||||
class APITransport:
|
||||
@property
|
||||
def transport_type(self) -> TransportType:
|
||||
|
|
|
@ -641,6 +641,7 @@ def main(from_package: bool = True) -> None:
|
|||
# it is ok to use a blocking sleep here
|
||||
time.sleep(.5)
|
||||
logging.info("Attempting Server Restart...")
|
||||
del server
|
||||
event_loop.reset()
|
||||
event_loop.close()
|
||||
logging.info("Server Shutdown")
|
||||
|
|
Loading…
Reference in New Issue