@@ -47,10 +47,10 @@ async def raw_execute(self) -> AsyncIterator[aiohttp.ClientResponse]:
47
47
)
48
48
if config .debug_mode :
49
49
print (f"[boostedblob] Making request: { self } " , file = sys .stderr )
50
- now = time .time ()
50
+ now = time .monotonic ()
51
51
async with ctx as resp :
52
52
if config .debug_mode :
53
- duration = time .time () - now
53
+ duration = time .monotonic () - now
54
54
print (
55
55
f"[boostedblob] Completed request, took { duration :.3f} s: { self } " ,
56
56
file = sys .stderr ,
@@ -106,7 +106,7 @@ async def execute(self) -> AsyncIterator[aiohttp.ClientResponse]:
106
106
jitter_fraction = config .backoff_jitter_fraction ,
107
107
)
108
108
):
109
- now = time .time ()
109
+ now = time .monotonic ()
110
110
if (now - last_auth_t ) > config .request_reauth_seconds :
111
111
if self .auth is not None :
112
112
rreq = await self .auth (self )
@@ -130,6 +130,11 @@ async def execute(self) -> AsyncIterator[aiohttp.ClientResponse]:
130
130
error = RequestFailure (reason = type (e ).__name__ + ": " + str (e ), request = self )
131
131
else :
132
132
if resp .status in self .success_codes :
133
+ url = urllib .parse .urlparse (self .url )
134
+ hostname = url .hostname
135
+ if hostname :
136
+ _hostname_check_cache [hostname ] = (now + 300 , False )
137
+
133
138
yield resp
134
139
return
135
140
@@ -377,7 +382,7 @@ async def inner(hostname: str) -> bool:
377
382
return True
378
383
379
384
# maybe this cache is a little bit overkill...
380
- now = time .time ()
385
+ now = time .monotonic ()
381
386
if hostname in _hostname_check_cache and _hostname_check_cache [hostname ][0 ] >= now :
382
387
return _hostname_check_cache [hostname ][1 ]
383
388
ret = await inner (hostname )
0 commit comments