1
0
Fork 0
mirror of https://github.com/element-hq/synapse.git synced 2025-03-20 14:44:46 +00:00

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
This commit is contained in:
Eric Eastwood 2025-03-18 05:53:21 -05:00 committed by GitHub
parent 4d2c4ce92b
commit d61bdff7a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 10 deletions

1
changelog.d/18123.misc Normal file
View file

@ -0,0 +1 @@
Remove undocumented `SYNAPSE_USE_FROZEN_DICTS` environment variable.

View file

@ -22,7 +22,6 @@
import abc import abc
import collections.abc import collections.abc
import os
from typing import ( from typing import (
TYPE_CHECKING, TYPE_CHECKING,
Any, Any,
@ -48,21 +47,21 @@ from synapse.synapse_rust.events import EventInternalMetadata
from synapse.types import JsonDict, StrCollection from synapse.types import JsonDict, StrCollection
from synapse.util.caches import intern_dict from synapse.util.caches import intern_dict
from synapse.util.frozenutils import freeze from synapse.util.frozenutils import freeze
from synapse.util.stringutils import strtobool
if TYPE_CHECKING: if TYPE_CHECKING:
from synapse.events.builder import EventBuilder 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") T = TypeVar("T")