Philipp Hörist pushed to branch master at gajim / gajim


Commits:
a67f2bd4 by Philipp Hörist at 2025-10-10T17:45:59+02:00
fix: Discovery: Add a cache per account

Fixes #12496

- - - - -


2 changed files:

- gajim/common/app.py
- gajim/gtk/discovery.py


Changes:

=====================================
gajim/common/app.py
=====================================
@@ -65,7 +65,7 @@
 connections: dict[str, types.Client] = {}
 avatar_cache: dict[str, dict[str, Any]] = {}
 bob_cache: dict[str, bytes] = {}
-services_cache: Any = None
+services_cache: dict[str, Any] = {}
 app = None  # type: GajimApplication
 window = None  # type: MainWindow
 commands = None  # type: ChatCommands


=====================================
gajim/gtk/discovery.py
=====================================
@@ -611,10 +611,10 @@ def __init__(
             raise RuntimeError("You must be connected to browse services")
 
         # Get a ServicesCache object.
-        self.cache = cast(ServicesCache, app.services_cache)
-        if app.services_cache is None:
+        self.cache = cast(ServicesCache | None, 
app.services_cache.get(account))
+        if self.cache is None:
             self.cache = ServicesCache(account)
-            app.services_cache = self.cache
+            app.services_cache[account] = self.cache
 
         self._ui = get_builder("service_discovery_window.ui")
         self.set_child(self._ui.service_discovery)
@@ -677,13 +677,6 @@ def __init__(
     def account(self) -> str:
         return self._account
 
-    @account.setter
-    def account(self, value: str) -> None:
-        self._account = value
-        self.cache.account = value
-        if self.browser:
-            self.browser.account = value
-
     def _initial_state(self):
         """
         Set some initial state on the window. Separated in a method because 
it's



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/a67f2bd445fc10f6ae56628027875c08a9d30ba1

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/a67f2bd445fc10f6ae56628027875c08a9d30ba1
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to