summary refs log tree commit diff
path: root/synapse/module_api
diff options
context:
space:
mode:
authorSean Quah <8349537+squahtx@users.noreply.github.com>2021-10-25 13:01:04 +0100
committerGitHub <noreply@github.com>2021-10-25 13:01:04 +0100
commit85a09f8b8ba7c8023c0d28a526d32111fc704197 (patch)
tree29af472de6f43ed5f8b8673e8f80ee8ebc821d96 /synapse/module_api
parentAdd type hints for most `HomeServer` parameters (#11095) (diff)
downloadsynapse-85a09f8b8ba7c8023c0d28a526d32111fc704197.tar.xz
Fix module API's `get_user_ip_and_agents` function when run on workers (#11112)
Diffstat (limited to 'synapse/module_api')
-rw-r--r--synapse/module_api/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py
index ab7ef8f950..d37252b6b3 100644
--- a/synapse/module_api/__init__.py
+++ b/synapse/module_api/__init__.py
@@ -46,6 +46,7 @@ from synapse.http.site import SynapseRequest
 from synapse.logging.context import make_deferred_yieldable, run_in_background
 from synapse.metrics.background_process_metrics import run_as_background_process
 from synapse.rest.client.login import LoginResponse
+from synapse.storage import DataStore
 from synapse.storage.database import DatabasePool, LoggingTransaction
 from synapse.storage.databases.main.roommember import ProfileInfo
 from synapse.storage.state import StateFilter
@@ -61,6 +62,7 @@ from synapse.util import Clock
 from synapse.util.caches.descriptors import cached
 
 if TYPE_CHECKING:
+    from synapse.app.generic_worker import GenericWorkerSlavedStore
     from synapse.server import HomeServer
 
 """
@@ -111,7 +113,9 @@ class ModuleApi:
     def __init__(self, hs: "HomeServer", auth_handler):
         self._hs = hs
 
-        self._store = hs.get_datastore()
+        # TODO: Fix this type hint once the types for the data stores have been ironed
+        #       out.
+        self._store: Union[DataStore, "GenericWorkerSlavedStore"] = hs.get_datastore()
         self._auth = hs.get_auth()
         self._auth_handler = auth_handler
         self._server_name = hs.hostname