Skip to content
Snippets Groups Projects
Commit 62d24f17 authored by Benziane Chakib's avatar Benziane Chakib
Browse files

added exponential timeout when trying to reconnect if authentication error

parent 14a7bbcd
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ import signal
import threading
import socket
from time import sleep
from math import exp
try:
import daemon
......@@ -66,6 +67,7 @@ def run_node(options):
logging.info('Connected to server %s' % options['address'])
def authentication():
timeout = 1
login = options['login'].replace('$HOSTNAME', socket.gethostname())
while node.manager.is_running():
try:
......@@ -74,6 +76,9 @@ def run_node(options):
logging.critical('Authentication error: %s' % error)
sleep(2)
else:
timeout += 0.1
print exp(timeout)
sleep(exp(timeout))
logging.info('Authenticated to server')
break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment