index : reflector32 | |
Archlinux32 fork of reflector | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2021-06-01 20:36:51 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2021-06-01 20:36:51 +0200 |
commit | 3e49ee9a9b9f517f0f53dbee73b498797cdec283 (patch) | |
tree | 0db182e0ddce8a26fbb0cac91c61cd0003305048 | |
parent | 3ea727741ce79de6172441a22a7af7cfc9519371 (diff) |
-rw-r--r-- | Reflector.py | 18 | ||||
-rw-r--r-- | setup.py | 2 |
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 @@ -5,7 +5,7 @@ import time setup( name='''Reflector''', - version=time.strftime('%Y.%m.%d.%H.%M.%S', time.gmtime(1607320056)), + version=time.strftime('%Y.%m.%d.%H.%M.%S', time.gmtime(1607321105)), description='''A Python 3 module and script to retrieve and filter the latest Pacman mirror list.''', author='''Xyne''', author_email='''ac xunilhcra enyx, backwards''', |