Use built-in treq timeout feature.

This commit is contained in:
Itamar Turner-Trauring 2022-11-07 09:23:04 -05:00
parent 1e50e96e24
commit 414b463556

View File

@ -415,12 +415,10 @@ class StorageClientGeneral(object):
Return the version metadata for the server.
"""
url = self._client.relative_url("/storage/v1/version")
result = self._client.request("GET", url)
# 1. Getting the version should never take particularly long.
# 2. Clients rely on the version command for liveness checks of servers.
result.addTimeout(5, self._client._clock)
response = yield result
# Thus, a short timeout.
response = yield self._client.request("GET", url, timeout=5)
decoded_response = yield _decode_cbor(response, _SCHEMAS["get_version"])
returnValue(decoded_response)