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))
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEgQG31Z317NrSMt0QiISIDS7+X/QFAmCBTGATHGFuZHJld0Bh
 bW9yZ2FuLnh5egAKCRCIhIgNLv5f9LB8EACvUiG5xkNjItcfv4udMKF9HbQCt0r2
 zlAmlffNrNqoCWpEi7cVY/48jeS6LEcN2pB4kQwKRrKl0RWdu9dL96m0DSUjwjiU
 gqJYEZLLgvnrAVoum91DvW3hiqUn8h1XEMd4VMo+4KeASoakrZOyo++Bj97gtN8H
 MiZbINYP51jDF8tSYNPhJW/kP7d67Zbf51Emi5JgMnUbonJc8ilg6uKsQg/fA1Gk
 iShEbOOqFM55VVbPq/bUnhWYzhiPq+pY1VJjMm0QmMnEupS6ANMYtXMt8ULpyZLO
 rEgpYlheADE7snrqLzPZPGjyi+jE35kUSOeYa3piB4OwZVhgron7dGWTdUSRkhx2
 cUu3JK3e2AO4eAH1sJKHs0k8T0q0jOQVcI0cTmmVskiqD2WueXWiM1YBq26IF953
 GTQaxHJ73ByOSCXb2eMlstljf5LPvuS+ywgN18jjX+adA0lBAKkcsce1btDxzlxF
 gY6f/DprV5X//H75gQt1tLml/G+58LbqPZRP4L8TcsyEviXk/zZ/K7w8e4+DqQ3/
 Zsu6rGxBEgX/ywVoPcYW6/P+ylsZ9rR2C9ujip+jdS/af4sDWh16DuGzj8eRoIeB
 M/e4bSopjVkWkh35cFgh/IMJlY3LbFJBNZyLQUG3sXiOXBRBrC+/7xTgYQXz82wW
 7M9fiwOmkLllOw==
 =KYWX
 -----END PGP SIGNATURE-----

Merge tag 'v1.32.2'

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))
This commit is contained in:
Andrew Morgan 2021-04-22 11:23:34 +01:00
commit 0f2629ebc6
4 changed files with 30 additions and 4 deletions

View File

@ -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) Synapse 1.32.1 (2021-04-21)
=========================== ===========================

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
matrix-synapse-py3 (1.32.2) stable; urgency=medium
* New synapse release 1.32.2.
-- Synapse Packaging team <packages@matrix.org> Wed, 22 Apr 2021 12:43:52 +0100
matrix-synapse-py3 (1.32.1) stable; urgency=medium matrix-synapse-py3 (1.32.1) stable; urgency=medium
* New synapse release 1.32.1. * New synapse release 1.32.1.

View File

@ -48,7 +48,7 @@ try:
except ImportError: except ImportError:
pass pass
__version__ = "1.32.1" __version__ = "1.32.2"
if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)): 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 # We import here so that we don't have to install a bunch of deps when

View File

@ -258,7 +258,8 @@ class LoggingContext:
child to the parent child to the parent
Args: 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 parent_context (LoggingContext|None): The parent of the new context
""" """
@ -277,12 +278,11 @@ class LoggingContext:
def __init__( def __init__(
self, self,
name: str, name: Optional[str] = None,
parent_context: "Optional[LoggingContext]" = None, parent_context: "Optional[LoggingContext]" = None,
request: Optional[ContextRequest] = None, request: Optional[ContextRequest] = None,
) -> None: ) -> None:
self.previous_context = current_context() self.previous_context = current_context()
self.name = name
# track the resources used by this context so far # track the resources used by this context so far
self._resource_usage = ContextResourceUsage() self._resource_usage = ContextResourceUsage()
@ -314,6 +314,15 @@ class LoggingContext:
# the request param overrides the request from the parent context # the request param overrides the request from the parent context
self.request = request 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: def __str__(self) -> str:
return self.name return self.name