to_dict_uncached: Pipe realm_id from the caller functions.

We pipe realm_id through functions where it is available,
this helps us avoid doing query for realm_id in loop when
multiple messages are being processed.
This commit is contained in:
Aman Agrawal
2020-06-02 13:33:20 +05:30
committed by Tim Abbott
parent 4b6ce8473e
commit ec257f6ec3
5 changed files with 54 additions and 35 deletions

View File

@@ -606,7 +606,7 @@ def flush_used_upload_space_cache(sender: Any, **kwargs: Any) -> None:
def to_dict_cache_key_id(message_id: int) -> str:
return 'message_dict:%d' % (message_id,)
def to_dict_cache_key(message: 'Message') -> str:
def to_dict_cache_key(message: 'Message', realm_id: Optional[int]=None) -> str:
return to_dict_cache_key_id(message.id)
def open_graph_description_cache_key(content: Any, request: HttpRequest) -> str: