Fehlerbehandlung in fastd2redis korrigiert

master
Thomas Hooge 2018-04-08 08:57:52 +02:00
parent ffbb2ae31d
commit 88cfca048f
1 changed files with 8 additions and 3 deletions

View File

@ -12,6 +12,8 @@ import subprocess
import datetime import datetime
from rediscluster import StrictRedisCluster from rediscluster import StrictRedisCluster
from rediscluster.exceptions import ClusterDownError
from redis.exceptions import ConnectionError
def get_gate_nodeid(): def get_gate_nodeid():
# Die ID kann statisch angegeben werden, falls das nicht # Die ID kann statisch angegeben werden, falls das nicht
@ -50,9 +52,12 @@ def main(rc):
except IndexError: except IndexError:
continue continue
rckey = "fastd:tunnel:%s" % tunnel_id rckey = "fastd:tunnel:%s" % tunnel_id
try:
rc.hset(rckey, 'key', key) rc.hset(rckey, 'key', key)
rc.hset(rckey, 'last_seen', now) rc.hset(rckey, 'last_seen', now)
rc.hset(rckey, 'last_gate', gate_id) rc.hset(rckey, 'last_gate', gate_id)
except ClusterDownError:
pass
if __name__ == '__main__': if __name__ == '__main__':
startup_nodes = [{"host": "127.0.0.1", "port": "7000"}] startup_nodes = [{"host": "127.0.0.1", "port": "7000"}]