summaryrefslogtreecommitdiff
path: root/backend/decky_loader/plugin/sandboxed_plugin.py
diff options
context:
space:
mode:
authorAAGaming <aagaming@riseup.net>2024-09-11 20:35:24 -0400
committerAAGaming <aagaming@riseup.net>2024-09-11 20:35:24 -0400
commit508408ad5ae3da687080210d4ad68608eda65d85 (patch)
tree406bc0f2e83b4dcec0533f2e8a8a5cedc0288c86 /backend/decky_loader/plugin/sandboxed_plugin.py
parentef4ca204bdce6b06072b9fb28d709742052a0c2c (diff)
downloaddecky-loader-508408ad5ae3da687080210d4ad68608eda65d85.tar.gz
decky-loader-508408ad5ae3da687080210d4ad68608eda65d85.zip
use signals to shut down plugins instead of sending a socket messagev3.0.0-pre13
should reduce or outright prevent shutdown stalls
Diffstat (limited to 'backend/decky_loader/plugin/sandboxed_plugin.py')
-rw-r--r--backend/decky_loader/plugin/sandboxed_plugin.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/backend/decky_loader/plugin/sandboxed_plugin.py b/backend/decky_loader/plugin/sandboxed_plugin.py
index b730fa98..6223fd04 100644
--- a/backend/decky_loader/plugin/sandboxed_plugin.py
+++ b/backend/decky_loader/plugin/sandboxed_plugin.py
@@ -40,6 +40,7 @@ class SandboxedPlugin:
self.author = author
self.api_version = api_version
self.shutdown_running = False
+ self.uninstalling = False
self.log = getLogger("sandboxed_plugin")
@@ -161,13 +162,13 @@ class SandboxedPlugin:
self.log.error("Failed to uninstall " + self.name + "!\n" + format_exc())
pass
- async def shutdown(self, uninstall: bool = False):
+ async def shutdown(self):
if not self.shutdown_running:
self.shutdown_running = True
self.log.info(f"Calling Loader unload function for {self.name}.")
await self._unload()
- if uninstall:
+ if self.uninstalling:
self.log.info("Calling Loader uninstall function.")
await self._uninstall()
@@ -180,8 +181,8 @@ class SandboxedPlugin:
async def on_new_message(self, message : str) -> str|None:
data = loads(message)
- if "stop" in data:
- await self.shutdown(data.get('uninstall'))
+ if "uninstall" in data:
+ self.uninstalling = data.get("uninstall")
d: SocketResponseDict = {"type": SocketMessageType.RESPONSE, "res": None, "success": True, "id": data["id"]}
try: