diff options
author | Dan McGee <dan@archlinux.org> | 2012-03-23 20:19:34 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-03-23 20:19:34 -0500 |
commit | 822898e57bc6d4e008ef58da309857e9ef8c98e6 (patch) | |
tree | 1af0836c927b87e2249628d47cdfefe77c3b18fd /mirrors/management | |
parent | ea87160c397fe1daf63851f0ed0be146bea79196 (diff) | |
parent | 8e10699d53281be53c88a3695de6aa496e084dc6 (diff) |
Merge branch 'django14'
Conflicts:
templates/releng/result_section.html
Diffstat (limited to 'mirrors/management')
-rw-r--r-- | mirrors/management/commands/mirrorcheck.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py index 8eb8b010..c2928e67 100644 --- a/mirrors/management/commands/mirrorcheck.py +++ b/mirrors/management/commands/mirrorcheck.py @@ -21,9 +21,11 @@ import sys import time from threading import Thread import types +from pytz import utc from Queue import Queue, Empty import urllib2 +from main.utils import utc_now from mirrors.models import MirrorUrl, MirrorLog logging.basicConfig( @@ -50,7 +52,7 @@ class Command(NoArgsCommand): def check_mirror_url(mirror_url): url = mirror_url.url + 'lastsync' logger.info("checking URL %s", url) - log = MirrorLog(url=mirror_url, check_time=datetime.utcnow()) + log = MirrorLog(url=mirror_url, check_time=utc_now()) try: start = time.time() result = urllib2.urlopen(url, timeout=10) @@ -61,6 +63,7 @@ def check_mirror_url(mirror_url): parsed_time = None try: parsed_time = datetime.utcfromtimestamp(int(data)) + parsed_time = parsed_time.replace(tzinfo=utc) except ValueError: # it is bad news to try logging the lastsync value; # sometimes we get a crazy-encoded web page. |