Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 10a08ab

Browse files
authored
Use the parent's logging context name for runWithConnection. (#9895)
This fixes a regression where the logging context for runWithConnection was reported as runWithConnection instead of the connection name, e.g. "POST-XYZ".
1 parent fa6679e commit 10a08ab

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

changelog.d/9895.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug introduced in v1.32.0 where the associated connection was improperly logged for SQL logging statements.

synapse/storage/database.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,9 @@ def inner_func(conn, *args, **kwargs):
715715
# pool).
716716
assert not self.engine.in_transaction(conn)
717717

718-
with LoggingContext("runWithConnection", parent_context) as context:
718+
with LoggingContext(
719+
str(curr_context), parent_context=parent_context
720+
) as context:
719721
sched_duration_sec = monotonic_time() - start_time
720722
sql_scheduling_timer.observe(sched_duration_sec)
721723
context.add_database_scheduled(sched_duration_sec)

0 commit comments

Comments
 (0)