Skip to content

Commit

Permalink
[uss_qualifier] Set timeout to uss qualifier client requests (interus…
Browse files Browse the repository at this point in the history
…s#879)

* [uss_qualifier] Set timeout to uss qualifier client

* Format

* Set timeout to 60 seconds
  • Loading branch information
barroco authored Nov 1, 2022
1 parent 8709b45 commit 32a2f14
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions monitoring/monitorlib/infrastructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

EPOCH = datetime.datetime.utcfromtimestamp(0)
TOKEN_REFRESH_MARGIN = datetime.timedelta(seconds=15)
CLIENT_TIMEOUT = 60 # seconds


class AuthAdapter(object):
Expand Down Expand Up @@ -112,6 +113,7 @@ def auth(
return prepared_request

kwargs["auth"] = auth
kwargs["timeout"] = CLIENT_TIMEOUT
return kwargs

def request(self, method, url, **kwargs):
Expand Down Expand Up @@ -166,6 +168,8 @@ def adjust_request_kwargs(self, url, method, kwargs):
if method == "PUT" and kwargs.get("data"):
kwargs["json"] = kwargs["data"]
del kwargs["data"]

kwargs["timeout"] = CLIENT_TIMEOUT
return kwargs

async def put(self, url, **kwargs):
Expand Down

0 comments on commit 32a2f14

Please sign in to comment.