From d61bdff7a445e6c9d345c23917ba920eb737717d Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 18 Mar 2025 05:53:21 -0500 Subject: [PATCH] Remove `SYNAPSE_USE_FROZEN_DICTS` environment variable (#18123) I got rid of the `SYNAPSE_USE_FROZEN_DICTS` environment variable because it will be overridden by the Synapse worker apps anyway and if we want to support `SYNAPSE_USE_FROZEN_DICTS`, it should be in `synapse/config/server.py`. It's also not documented so I'm assuming no one is using it anyway. Spawning from looking at the frozen dict stuff during the review of https://github.com/element-hq/synapse/pull/18103#discussion_r1935876168 --- changelog.d/18123.misc | 1 + synapse/events/__init__.py | 19 +++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 changelog.d/18123.misc diff --git a/changelog.d/18123.misc b/changelog.d/18123.misc new file mode 100644 index 0000000000..5ae23eb07d --- /dev/null +++ b/changelog.d/18123.misc @@ -0,0 +1 @@ +Remove undocumented `SYNAPSE_USE_FROZEN_DICTS` environment variable. diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py index 13d41592b3..a85e66d6bf 100644 --- a/synapse/events/__init__.py +++ b/synapse/events/__init__.py @@ -22,7 +22,6 @@ import abc import collections.abc -import os from typing import ( TYPE_CHECKING, Any, @@ -48,21 +47,21 @@ from synapse.synapse_rust.events import EventInternalMetadata from synapse.types import JsonDict, StrCollection from synapse.util.caches import intern_dict from synapse.util.frozenutils import freeze -from synapse.util.stringutils import strtobool if TYPE_CHECKING: from synapse.events.builder import EventBuilder -# Whether we should use frozen_dict in FrozenEvent. Using frozen_dicts prevents -# bugs where we accidentally share e.g. signature dicts. However, converting a -# dict to frozen_dicts is expensive. -# -# NOTE: This is overridden by the configuration by the Synapse worker apps, but -# for the sake of tests, it is set here while it cannot be configured on the -# homeserver object itself. -USE_FROZEN_DICTS = strtobool(os.environ.get("SYNAPSE_USE_FROZEN_DICTS", "0")) +USE_FROZEN_DICTS = False +""" +Whether we should use frozen_dict in FrozenEvent. Using frozen_dicts prevents +bugs where we accidentally share e.g. signature dicts. However, converting a +dict to frozen_dicts is expensive. +NOTE: This is overridden by the configuration by the Synapse worker apps, but +for the sake of tests, it is set here because it cannot be configured on the +homeserver object itself. +""" T = TypeVar("T")