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

Commit

Permalink
Merge tag 'v1.32.2'
Browse files Browse the repository at this point in the history
Synapse 1.32.2 (2021-04-22)
===========================

This release includes a fix for a regression introduced in 1.32.0.

Bugfixes
--------

- Fix a regression in Synapse 1.32.0 and 1.32.1 which caused `LoggingContext` errors in plugins. ([\#9857](#9857))
  • Loading branch information
anoadragon453 committed Apr 22, 2021
2 parents 046175d + dac4445 commit 0f2629e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
11 changes: 11 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
Synapse 1.32.2 (2021-04-22)
===========================

This release includes a fix for a regression introduced in 1.32.0.

Bugfixes
--------

- Fix a regression in Synapse 1.32.0 and 1.32.1 which caused `LoggingContext` errors in plugins. ([\#9857](https://github.com/matrix-org/synapse/issues/9857))


Synapse 1.32.1 (2021-04-21)
===========================

Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
matrix-synapse-py3 (1.32.2) stable; urgency=medium

* New synapse release 1.32.2.

-- Synapse Packaging team <[email protected]> Wed, 22 Apr 2021 12:43:52 +0100

matrix-synapse-py3 (1.32.1) stable; urgency=medium

* New synapse release 1.32.1.
Expand Down
2 changes: 1 addition & 1 deletion synapse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
except ImportError:
pass

__version__ = "1.32.1"
__version__ = "1.32.2"

if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
# We import here so that we don't have to install a bunch of deps when
Expand Down
15 changes: 12 additions & 3 deletions synapse/logging/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ class LoggingContext:
child to the parent
Args:
name (str): Name for the context for debugging.
name: Name for the context for logging. If this is omitted, it is
inherited from the parent context.
parent_context (LoggingContext|None): The parent of the new context
"""

Expand All @@ -277,12 +278,11 @@ class LoggingContext:

def __init__(
self,
name: str,
name: Optional[str] = None,
parent_context: "Optional[LoggingContext]" = None,
request: Optional[ContextRequest] = None,
) -> None:
self.previous_context = current_context()
self.name = name

# track the resources used by this context so far
self._resource_usage = ContextResourceUsage()
Expand Down Expand Up @@ -314,6 +314,15 @@ def __init__(
# the request param overrides the request from the parent context
self.request = request

# if we don't have a `name`, but do have a parent context, use its name.
if self.parent_context and name is None:
name = str(self.parent_context)
if name is None:
raise ValueError(
"LoggingContext must be given either a name or a parent context"
)
self.name = name

def __str__(self) -> str:
return self.name

Expand Down

0 comments on commit 0f2629e

Please sign in to comment.