# we could stop all the children one by one right now
# we won't do that and we leave that up to the subprocess controller to do that while it is shutting down
await self._controller.shutdown_controller()
+ # now, when everything is stopped, let's clean up all the remains
+ await asyncio.gather(*[w.cleanup() for w in self._workers])
async def forced_shutdown(self) -> None:
logger.warning("Collecting all remaining workers...")
if self._metrics_registered:
unregister_resolver_metrics_for(self)
await self._stop()
+ await self.cleanup()
+
+ async def cleanup(self) -> None:
+ """
+ Remove temporary files and all traces of this instance running. It is NOT SAFE to call this while
+ the kresd is running, because it will break automatic restarts (at the very least).
+ """
kresd_config_file(self._config, self.id).unlink()
def __eq__(self, o: object) -> bool: