summaryrefslogtreecommitdiff
path: root/mirrors
diff options
context:
space:
mode:
Diffstat (limited to 'mirrors')
-rw-r--r--mirrors/management/commands/mirrorcheck.py2
-rw-r--r--mirrors/utils.py9
2 files changed, 5 insertions, 6 deletions
diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py
index 8c17c78f..1f16a375 100644
--- a/mirrors/management/commands/mirrorcheck.py
+++ b/mirrors/management/commands/mirrorcheck.py
@@ -238,7 +238,7 @@ class MirrorCheckPool(object):
for url in list(urls):
self.tasks.put(url)
self.threads = []
- for i in range(num_threads):
+ for _ in range(num_threads):
thread = Thread(target=mirror_url_worker,
args=(self.tasks, self.logs, location, timeout))
thread.daemon = True
diff --git a/mirrors/utils.py b/mirrors/utils.py
index 533cd452..7c2f5d17 100644
--- a/mirrors/utils.py
+++ b/mirrors/utils.py
@@ -4,7 +4,6 @@ from django.db import connection
from django.db.models import Count, Max, Min
from django.utils.dateparse import parse_datetime
from django.utils.timezone import now
-from django_countries.fields import Country
from main.utils import cache_function, database_vendor
from .models import MirrorLog, MirrorUrl
@@ -184,12 +183,12 @@ def get_mirror_url_for_download(cutoff=DEFAULT_CUTOFF):
status data available, it is used to determine a good choice by looking at
the last batch of status rows.'''
cutoff_time = now() - cutoff
- status_data = MirrorLog.objects.filter(
+ log_data = MirrorLog.objects.filter(
check_time__gte=cutoff_time).aggregate(
Max('check_time'), Max('last_sync'))
- if status_data['check_time__max'] is not None:
- min_check_time = status_data['check_time__max'] - timedelta(minutes=5)
- min_sync_time = status_data['last_sync__max'] - timedelta(minutes=20)
+ if log_data['check_time__max'] is not None:
+ min_check_time = log_data['check_time__max'] - timedelta(minutes=5)
+ min_sync_time = log_data['last_sync__max'] - timedelta(minutes=20)
best_logs = MirrorLog.objects.select_related('url').filter(
is_success=True,
check_time__gte=min_check_time, last_sync__gte=min_sync_time,