summaryrefslogtreecommitdiffstats
path: root/pyload/datatypes/OnlineCheck.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/datatypes/OnlineCheck.py')
-rw-r--r--pyload/datatypes/OnlineCheck.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pyload/datatypes/OnlineCheck.py b/pyload/datatypes/OnlineCheck.py
index 2797828bf..b0b19cf76 100644
--- a/pyload/datatypes/OnlineCheck.py
+++ b/pyload/datatypes/OnlineCheck.py
@@ -5,6 +5,7 @@ from time import time
from pyload.Api import OnlineCheck as OC
+
class OnlineCheck:
""" Helper class that holds result of an initiated online check """
@@ -16,6 +17,10 @@ class OnlineCheck:
self.timestamp = time()
+ def isStale(self, timeout=5):
+ """ checks if the data was updated or accessed recently """
+ return self.timestamp + timeout * 60 < time()
+
def update(self, result):
self.timestamp = time()
self.result.update(result)