From 49bf4988794c39095a9513c32ea971d5bcf5d33d Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 1 Jun 2013 09:21:42 -0500 Subject: Ensure only active mirror URLs are listed This fixes things up on the download page as well as the individual mirror details page. Signed-off-by: Dan McGee --- mirrors/models.py | 1 + mirrors/views.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'mirrors') diff --git a/mirrors/models.py b/mirrors/models.py index 975ead39..da3d8c0d 100644 --- a/mirrors/models.py +++ b/mirrors/models.py @@ -116,6 +116,7 @@ def __unicode__(self): class Meta: verbose_name = 'mirror rsync IP' + ordering = ('ip',) class CheckLocation(models.Model): diff --git a/mirrors/views.py b/mirrors/views.py index 6f4ad838..ec056696 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -161,7 +161,7 @@ def mirror_details(request, name): status_info = get_mirror_statuses(mirror_id=mirror.id) checked_urls = {url for url in status_info['urls'] \ if url.mirror_id == mirror.id} - all_urls = set(mirror.urls.select_related('protocol')) + all_urls = set(mirror.urls.filter(active=True).select_related('protocol')) # Add dummy data for URLs that we haven't checked recently other_urls = all_urls.difference(checked_urls) for url in other_urls: -- cgit v1.2.3-54-g00ecf From 80d323c39218d113d3002f5bf76bd464cddfcb95 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 1 Jun 2013 14:53:51 -0500 Subject: Guard logging operation to prevent needless text join Signed-off-by: Dan McGee --- mirrors/management/commands/mirrorcheck.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mirrors') diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py index 6faf294a..3f026c36 100644 --- a/mirrors/management/commands/mirrorcheck.py +++ b/mirrors/management/commands/mirrorcheck.py @@ -179,10 +179,11 @@ def check_rsync_url(mirror_url, location, timeout): rsync_cmd.append(lastsync_path) try: with open(os.devnull, 'w') as devnull: - logger.debug("rsync cmd: %s", ' '.join(rsync_cmd)) + if logger.isEnabledFor(logging.DEBUG): + logger.debug("rsync cmd: %s", ' '.join(rsync_cmd)) + start = time.time() proc = subprocess.Popen(rsync_cmd, stdout=devnull, stderr=subprocess.PIPE) - start = time.time() _, errdata = proc.communicate() end = time.time() log.duration = end - start -- cgit v1.2.3-54-g00ecf From 9e4a0939145505e7f606ee8b66ea1acd092abb85 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 20 Jun 2013 14:11:23 -0500 Subject: Re-enable caching for somewhat expensive mirror status query This should be a small enough chunk of data that it isn't super expensive to put into and pull out of memcached. Signed-off-by: Dan McGee --- mirrors/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mirrors') diff --git a/mirrors/utils.py b/mirrors/utils.py index e98b5c9f..bba8e36b 100644 --- a/mirrors/utils.py +++ b/mirrors/utils.py @@ -21,7 +21,7 @@ def dictfetchall(cursor): for row in cursor.fetchall() ] - +@cache_function(178) def status_data(cutoff_time, mirror_id=None): if mirror_id is not None: params = [cutoff_time, mirror_id] -- cgit v1.2.3-54-g00ecf From 5a09edf67da7c92b5a396b80f01ae3c1fec48f6e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 14 Jul 2013 15:04:23 -0600 Subject: add copyright header to mirrors/static/mirror_status.js --- mirrors/static/mirror_status.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'mirrors') diff --git a/mirrors/static/mirror_status.js b/mirrors/static/mirror_status.js index 241f5c61..44c81935 100644 --- a/mirrors/static/mirror_status.js +++ b/mirrors/static/mirror_status.js @@ -1,3 +1,23 @@ +/* mirror_status.js + * Homepage: https://projects.archlinux.org/archweb.git/ + * Copyright: 2012-2013 The Archweb Team (Dan McGee) + * License: GPLv2 + * + * This file is part of Archweb. + * + * Archweb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Archweb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Archweb. If not, see . + */ + function draw_graphs(location_url, log_url, container_id) { jQuery.when(jQuery.getJSON(location_url), jQuery.getJSON(log_url)) .then(function(loc_data, log_data) { -- cgit v1.2.3-54-g00ecf