mirror of
https://github.com/Flowseal/tg-ws-proxy.git
synced 2026-11-23 16:06:32 +03:00
time measure unification
This commit is contained in:
+2
-2
@@ -405,14 +405,14 @@ class _CfWorkerPool:
|
||||
return domains
|
||||
|
||||
def report_failure(self, worker_domain: str, exc: Exception) -> None:
|
||||
now = time.time()
|
||||
now = time.monotonic()
|
||||
if self._exhausted_until.get(worker_domain, 0) > now:
|
||||
return
|
||||
|
||||
if isinstance(exc, WsHandshakeError):
|
||||
if exc.status_code == 429:
|
||||
# Workers free plan reports the daily request limit as 429.
|
||||
exhausted_until = now + (86400 - (now % 86400))
|
||||
exhausted_until = now + (86400 - (time.time() % 86400))
|
||||
reason = 'daily request limit'
|
||||
elif exc.status_code >= 500:
|
||||
exhausted_until = now + self.FAILURE_COOLDOWN
|
||||
|
||||
Reference in New Issue
Block a user