summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-06-01 14:53:51 -0500
committerDan McGee <dan@archlinux.org>2013-06-01 14:53:51 -0500
commit80d323c39218d113d3002f5bf76bd464cddfcb95 (patch)
tree0c504e24940c69627eaf54f5213dac6ee06cd3bb
parent49bf4988794c39095a9513c32ea971d5bcf5d33d (diff)
Guard logging operation to prevent needless text join
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--mirrors/management/commands/mirrorcheck.py5
1 files changed, 3 insertions, 2 deletions
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