diff --git a/packages/opal-server/opal_server/scopes/api.py b/packages/opal-server/opal_server/scopes/api.py index 102bccac4..89ac1ab2c 100644 --- a/packages/opal-server/opal_server/scopes/api.py +++ b/packages/opal-server/opal_server/scopes/api.py @@ -173,6 +173,8 @@ async def delete_scope( logger.error(f"Unauthorized to delete scope: {repr(ex)}") raise + await scopes.delete(scope_id) + from opal_server.worker import delete_scope delete_scope.delay(scope_id) diff --git a/packages/opal-server/opal_server/worker.py b/packages/opal-server/opal_server/worker.py index 0f41b1529..3ce712a5d 100644 --- a/packages/opal-server/opal_server/worker.py +++ b/packages/opal-server/opal_server/worker.py @@ -208,8 +208,6 @@ async def delete_scope(self, scope_id: str): ) shutil.rmtree(scope_dir, ignore_errors=True) - await scopes.delete(scope_id) - async def sync_scopes(self, only_poll_updates=False): with tracer.trace("worker.sync_scopes"): scopes = await self._scopes.all()