summaryrefslogtreecommitdiffstats
path: root/bitvend/processor.py
diff options
context:
space:
mode:
authorPiotr Dobrowolski <admin@tastycode.pl>2017-01-17 01:05:45 +0100
committerPiotr Dobrowolski <admin@tastycode.pl>2017-01-17 01:05:45 +0100
commit9209cd077ac2b246b99196f42cae72ce4ebb22b5 (patch)
treefcdb6d529c2058e9afaacfa7f9d267d05c15acf3 /bitvend/processor.py
parentdc1a83c9819c8c4a58481d637ac804fe2d457a93 (diff)
downloadbitvend-9209cd077ac2b246b99196f42cae72ce4ebb22b5.tar.gz
bitvend-9209cd077ac2b246b99196f42cae72ce4ebb22b5.tar.bz2
bitvend-9209cd077ac2b246b99196f42cae72ce4ebb22b5.tar.xz
bitvend-9209cd077ac2b246b99196f42cae72ce4ebb22b5.zip
Add subsystems status display
Diffstat (limited to 'bitvend/processor.py')
-rw-r--r--bitvend/processor.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/bitvend/processor.py b/bitvend/processor.py
index 73f5c17..40313f7 100644
--- a/bitvend/processor.py
+++ b/bitvend/processor.py
@@ -12,7 +12,7 @@ class PaymentProcessor(threading.Thread):
daemon = True
input_address = None
device = None
- last_pong = None
+ last_pong = 0
app = None
def __init__(self, device, input_address=None, chain_id=None, app=None):
@@ -112,7 +112,6 @@ class PaymentProcessor(threading.Thread):
def keepalive(self, ws):
# Keepalive thread target, just send ping once in a while
- self.last_pong = time.time()
while True:
# FIXME check last ping time
ws.send(json.dumps({
@@ -120,7 +119,11 @@ class PaymentProcessor(threading.Thread):
}))
time.sleep(20)
- if time.time() - self.last_pong > 30:
+ if time.time() - self.last_pong > 60:
self.logger.warning('Closing socket for inactivity')
ws.close()
return
+
+ @property
+ def online(self):
+ return time.time() - self.last_pong < 40