From a4137ffe7e1dff8c18e3497b2c1f6a3f7095b6a7 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 21 Jan 2025 10:18:16 +0000 Subject: [PATCH] mirrors: Add faster timeouts to mirror checks The checker used to freeze here sometimes as the default timeouts where pretty much to infinity and beyond. Signed-off-by: Michael Tremer --- src/backend/mirrors.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/backend/mirrors.py b/src/backend/mirrors.py index b1d8a6a5..26958553 100644 --- a/src/backend/mirrors.py +++ b/src/backend/mirrors.py @@ -238,8 +238,18 @@ class Mirror(Object): async def check_timestamp(self): try: - response = await self.backend.http_client.fetch(self.url + ".timestamp", - headers={ "Pragma" : "no-cache" }) + response = await self.backend.http_client.fetch( + self.url + ".timestamp", + headers = { + "Pragma" : "no-cache", + }, + + # We are really not very patient with this, because if the + # mirror cannot give us the timestamp swiftly, it is probably + # very overloaded and won't respond quickly to any file requests. + connect_timeout = 10, + request_timeout = 10, + ) except tornado.httpclient.HTTPError as e: logging.warning("Error getting timestamp from %s: %s" % (self.hostname, e)) self.set_state("DOWN") @@ -288,8 +298,16 @@ class Mirror(Object): return try: - response = await self.backend.http_client.fetch(self.url + ".filelist", - headers={ "Pragma" : "no-cache" }) + response = await self.backend.http_client.fetch( + self.url + ".filelist", + headers = { + "Pragma" : "no-cache", + }, + + # Don't wait very long for this + connect_timeout = 10, + request_timeout = 10, + ) except tornado.httpclient.HTTPError as e: logging.warning("Error getting filelist from %s: %s" % (self.hostname, e)) self.set_state("DOWN") -- 2.47.3