mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-08-03 16:04:12 -04:00
Cache empty responses from /user/devices
(#11587)
If we've never made a request to a remote homeserver, we should cache the response---even if the response is "this user has no devices".
This commit is contained in:
parent
0fb3dd0830
commit
88a78c6577
5 changed files with 114 additions and 5 deletions
|
@ -19,7 +19,7 @@ import sys
|
|||
import warnings
|
||||
from asyncio import Future
|
||||
from binascii import unhexlify
|
||||
from typing import Any, Awaitable, Callable, TypeVar
|
||||
from typing import Awaitable, Callable, TypeVar
|
||||
from unittest.mock import Mock
|
||||
|
||||
import attr
|
||||
|
@ -46,7 +46,7 @@ def get_awaitable_result(awaitable: Awaitable[TV]) -> TV:
|
|||
raise Exception("awaitable has not yet completed")
|
||||
|
||||
|
||||
def make_awaitable(result: Any) -> Awaitable[Any]:
|
||||
def make_awaitable(result: TV) -> Awaitable[TV]:
|
||||
"""
|
||||
Makes an awaitable, suitable for mocking an `async` function.
|
||||
This uses Futures as they can be awaited multiple times so can be returned
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue