From 205e6d17e3af1133de366b5d3a88d0e15ad2e511 Mon Sep 17 00:00:00 2001 From: eliska-n Date: Wed, 28 Aug 2024 14:05:21 +0200 Subject: [PATCH] use the new functionality of task service to schedule threadsafe --- asab/api/discovery.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/asab/api/discovery.py b/asab/api/discovery.py index 9b794241..137fdda4 100644 --- a/asab/api/discovery.py +++ b/asab/api/discovery.py @@ -356,9 +356,7 @@ def get_data(item): def _on_change_threadsafe(self, watched_event): # Runs on a thread, returns the process back to the main thread - def _update_cache(): - self.App.TaskService.schedule(self._rescan_advertised_instances()) - self.App.Loop.call_soon_threadsafe(_update_cache) + self.App.TaskService.schedule_threadsafe(self._rescan_advertised_instances()) def session(self, base_url=None, auth=None, headers=None, **kwargs) -> aiohttp.ClientSession: