mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-12-15 17:01:06 -05:00
Use inline type hints in http/federation/, storage/ and util/ (#10381)
This commit is contained in:
parent
3acf85c85f
commit
bdfde6dca1
38 changed files with 149 additions and 161 deletions
|
|
@ -70,10 +70,8 @@ WELL_KNOWN_RETRY_ATTEMPTS = 3
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
_well_known_cache = TTLCache("well-known") # type: TTLCache[bytes, Optional[bytes]]
|
||||
_had_valid_well_known_cache = TTLCache(
|
||||
"had-valid-well-known"
|
||||
) # type: TTLCache[bytes, bool]
|
||||
_well_known_cache: TTLCache[bytes, Optional[bytes]] = TTLCache("well-known")
|
||||
_had_valid_well_known_cache: TTLCache[bytes, bool] = TTLCache("had-valid-well-known")
|
||||
|
||||
|
||||
@attr.s(slots=True, frozen=True)
|
||||
|
|
@ -130,9 +128,10 @@ class WellKnownResolver:
|
|||
# requests for the same server in parallel?
|
||||
try:
|
||||
with Measure(self._clock, "get_well_known"):
|
||||
result, cache_period = await self._fetch_well_known(
|
||||
server_name
|
||||
) # type: Optional[bytes], float
|
||||
result: Optional[bytes]
|
||||
cache_period: float
|
||||
|
||||
result, cache_period = await self._fetch_well_known(server_name)
|
||||
|
||||
except _FetchWellKnownFailure as e:
|
||||
if prev_result and e.temporary:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue