mirror of https://github.com/zulip/zulip.git
models: Move flush_per_request_caches after cache definitions.
This will work around https://bugs.python.org/issue34939 when we convert the type comment to a Python 3.6 style annotation. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
f8c95cda51
commit
af1aef9b39
|
@ -99,12 +99,6 @@ def get_display_recipient(recipient: 'Recipient') -> DisplayRecipientT:
|
||||||
recipient.type_id
|
recipient.type_id
|
||||||
)
|
)
|
||||||
|
|
||||||
def flush_per_request_caches() -> None:
|
|
||||||
global per_request_display_recipient_cache
|
|
||||||
per_request_display_recipient_cache = {}
|
|
||||||
global per_request_realm_filters_cache
|
|
||||||
per_request_realm_filters_cache = {}
|
|
||||||
|
|
||||||
def get_realm_emoji_cache_key(realm: 'Realm') -> str:
|
def get_realm_emoji_cache_key(realm: 'Realm') -> str:
|
||||||
return 'realm_emoji:%s' % (realm.id,)
|
return 'realm_emoji:%s' % (realm.id,)
|
||||||
|
|
||||||
|
@ -720,6 +714,12 @@ def flush_realm_filter(sender: Any, **kwargs: Any) -> None:
|
||||||
post_save.connect(flush_realm_filter, sender=RealmFilter)
|
post_save.connect(flush_realm_filter, sender=RealmFilter)
|
||||||
post_delete.connect(flush_realm_filter, sender=RealmFilter)
|
post_delete.connect(flush_realm_filter, sender=RealmFilter)
|
||||||
|
|
||||||
|
def flush_per_request_caches() -> None:
|
||||||
|
global per_request_display_recipient_cache
|
||||||
|
per_request_display_recipient_cache = {}
|
||||||
|
global per_request_realm_filters_cache
|
||||||
|
per_request_realm_filters_cache = {}
|
||||||
|
|
||||||
# The Recipient table is used to map Messages to the set of users who
|
# The Recipient table is used to map Messages to the set of users who
|
||||||
# received the message. It is implemented as a set of triples (id,
|
# received the message. It is implemented as a set of triples (id,
|
||||||
# type_id, type). We have 3 types of recipients: Huddles (for group
|
# type_id, type). We have 3 types of recipients: Huddles (for group
|
||||||
|
|
Loading…
Reference in New Issue