summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2021-01-05 08:06:55 -0500
committerGitHub <noreply@github.com>2021-01-05 08:06:55 -0500
commit06fefe0bb19d5ef0a5873ea5697e2018ce9e6026 (patch)
tree7f890b4ecaf561d5bdf31494423fc6839f0e0b36 /synapse/storage
parentImplement MSC2176: Updated redaction rules (#8984) (diff)
downloadsynapse-06fefe0bb19d5ef0a5873ea5697e2018ce9e6026.tar.xz
Add type hints to the logging context code. (#8939)
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/database.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/storage/database.py b/synapse/storage/database.py
index d1b5760c2c..b70ca3087b 100644
--- a/synapse/storage/database.py
+++ b/synapse/storage/database.py
@@ -42,7 +42,6 @@ from synapse.api.errors import StoreError
 from synapse.config.database import DatabaseConnectionConfig
 from synapse.logging.context import (
     LoggingContext,
-    LoggingContextOrSentinel,
     current_context,
     make_deferred_yieldable,
 )
@@ -671,12 +670,15 @@ class DatabasePool:
         Returns:
             The result of func
         """
-        parent_context = current_context()  # type: Optional[LoggingContextOrSentinel]
-        if not parent_context:
+        curr_context = current_context()
+        if not curr_context:
             logger.warning(
                 "Starting db connection from sentinel context: metrics will be lost"
             )
             parent_context = None
+        else:
+            assert isinstance(curr_context, LoggingContext)
+            parent_context = curr_context
 
         start_time = monotonic_time()