From 5441a9977d3e3f98ddff39a5fe4ae366dc7f7b70 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Tue, 2 Oct 2018 17:03:19 +1000 Subject: [PATCH] fix --- synapse/events/__init__.py | 12 +++++++++--- tests/utils.py | 7 +------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py index 1d5dcd516c12..e7dddccdf1a4 100644 --- a/synapse/events/__init__.py +++ b/synapse/events/__init__.py @@ -13,15 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os + import six from synapse.util.caches import intern_dict from synapse.util.frozenutils import freeze # 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. -USE_FROZEN_DICTS = False +# 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 script entry +# points, but for the sake of tests, it is set here while it cannot be +# configured on the homeserver object itself. +USE_FROZEN_DICTS = os.environ.get("SYNAPSE_USE_FROZEN_DICTS", False) class _EventInternalMetadata(object): diff --git a/tests/utils.py b/tests/utils.py index 397c5be6e915..864d7fac3d89 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -48,10 +48,6 @@ POSTGRES_USER = os.environ.get("SYNAPSE_POSTGRES_USER", "postgres") POSTGRES_BASE_DB = "_synapse_unit_tests_base_%s" % (os.getpid(),) -# Disable frozendicts by default, but enable if the environment var is set. -USE_FROZEN_DICTS = os.environ.get("SYNAPSE_USE_FROZEN_DICTS", False) - - def setupdb(): # If we're using PostgreSQL, set up the db once @@ -139,8 +135,7 @@ def default_config(name): config.rc_messages_per_second = 10000 config.rc_message_burst_count = 10000 - # Use frozendicts if they're asked for. - config.use_frozen_dicts = bool(USE_FROZEN_DICTS) + config.use_frozen_dicts = False # we need a sane default_room_version, otherwise attempts to create rooms will # fail.