summaryrefslogtreecommitdiff
path: root/mirrors/models.py
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-12-22 21:50:58 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-12-22 21:50:58 -0500
commit2bfec5b17ca3ee3ea3b347c029b9d8dad3c5b4d0 (patch)
tree6bda86f6489fbdfdce67d282b20586fc6032735b /mirrors/models.py
parent3579e3cb34a53abd16da3af78be738c2a4dd0d5c (diff)
parent36f5e1df9afbeac1d04fee38dde4c28f81144a20 (diff)
Merge tag 'release_2013-12-19' into archweb-generic
Mirror URL page, other random stuff
Diffstat (limited to 'mirrors/models.py')
-rw-r--r--mirrors/models.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mirrors/models.py b/mirrors/models.py
index 47e2051b..57664562 100644
--- a/mirrors/models.py
+++ b/mirrors/models.py
@@ -1,3 +1,4 @@
+from datetime import timedelta
import socket
from urlparse import urlparse
@@ -159,6 +160,14 @@ class MirrorLog(models.Model):
is_success = models.BooleanField(default=True)
error = models.TextField(blank=True, default='')
+ def delay(self):
+ if self.last_sync is None:
+ return None
+ # sanity check, this shouldn't happen
+ if self.check_time < self.last_sync:
+ return timedelta()
+ return self.check_time - self.last_sync
+
def __unicode__(self):
return "Check of %s at %s" % (self.url.url, self.check_time)