mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-03 13:26:02 -04:00
Add config option to turn off freezing events. Use new encode_json api and ujson.loads
This commit is contained in:
parent
afbd3b2fc4
commit
a7b65bdedf
8 changed files with 44 additions and 17 deletions
|
@ -16,6 +16,12 @@
|
|||
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 = True
|
||||
|
||||
|
||||
class _EventInternalMetadata(object):
|
||||
def __init__(self, internal_metadata_dict):
|
||||
self.__dict__ = dict(internal_metadata_dict)
|
||||
|
@ -122,7 +128,10 @@ class FrozenEvent(EventBase):
|
|||
|
||||
unsigned = dict(event_dict.pop("unsigned", {}))
|
||||
|
||||
frozen_dict = freeze(event_dict)
|
||||
if USE_FROZEN_DICTS:
|
||||
frozen_dict = freeze(event_dict)
|
||||
else:
|
||||
frozen_dict = dict(event_dict)
|
||||
|
||||
super(FrozenEvent, self).__init__(
|
||||
frozen_dict,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue