Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/Reflector.py
diff options
context:
space:
mode:
Diffstat (limited to 'Reflector.py')
-rw-r--r--Reflector.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/Reflector.py b/Reflector.py
index 95b6798..7b6b7ab 100644
--- a/Reflector.py
+++ b/Reflector.py
@@ -206,10 +206,20 @@ class DownloadTimer():
return self
def __exit__(self, typ, value, traceback):
- self.time = time.time() - self.start_time
+ time_delta = time.time() - self.start_time
+ signal.alarm(0)
+ self.time = time_delta
if self.timeout > 0:
signal.signal(signal.SIGALRM, self.previous_handler)
- signal.alarm(self.previous_timer)
+
+ previous_timer = self.previous_timer
+ if previous_timer > 0:
+ remaining_time = int(previous_timer - time_delta)
+ # The alarm should have been raised during the download.
+ if remaining_time <= 0:
+ signal.raise_signal(signal.SIGALRM)
+ else:
+ signal.alarm(remaining_time)
self.start_time = None
@@ -276,7 +286,7 @@ def rate_rsync(
DownloadTimeout
) as err:
logger = get_logger()
- logger.info('failed to rate rsync download (%s): %s', db_url, err)
+ logger.warning('failed to rate rsync download (%s): %s', db_url, err)
return 0, 0
@@ -304,7 +314,7 @@ def rate_http(
DownloadTimeout
) as err:
logger = get_logger()
- logger.info('failed to rate http(s) download (%s): %s', db_url, err)
+ logger.warning('failed to rate http(s) download (%s): %s', db_url, err)
return 0, 0