Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove SYNAPSE_USE_FROZEN_DICTS environment variable #18123

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/18123.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove undocumented `SYNAPSE_USE_FROZEN_DICTS` environment variable.
19 changes: 9 additions & 10 deletions synapse/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import abc
import collections.abc
import os
from typing import (
TYPE_CHECKING,
Any,
Expand All @@ -48,21 +47,21 @@
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.
Comment on lines -56 to -62
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this to a comment doc so the information appears on hover.


USE_FROZEN_DICTS = strtobool(os.environ.get("SYNAPSE_USE_FROZEN_DICTS", "0"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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")

Expand Down
Loading