Wait for server to become avaliable
This commit is contained in:
parent
fc95b26c45
commit
11a4c760d7
1 changed files with 10 additions and 4 deletions
|
@ -347,14 +347,20 @@ except (IOError, ExceptionInConfigError):
|
|||
|
||||
|
||||
try:
|
||||
ws = Handler(config.server_address)
|
||||
# setup has to be called before the connection is established
|
||||
ws.setup({"subscribe" : Subscribe(), "sensor" : Sensor(),
|
||||
while 1:
|
||||
ws = Handler(config.server_address)
|
||||
# setup has to be called before the connection is established
|
||||
ws.setup({"subscribe" : Subscribe(), "sensor" : Sensor(),
|
||||
"identify" : Identify(), "whoami" : WhoAmI(),
|
||||
"stop_programs" : StopPrograms(), "shutdown" : Shutdown(),
|
||||
"reboot" : Reboot(), "output" : Output()},
|
||||
debug=False)
|
||||
ws.connect()
|
||||
try:
|
||||
ws.connect()
|
||||
break
|
||||
except ConnectionRefusedError:
|
||||
Logging.warning("Server not running... Retrying in 5s")
|
||||
time.sleep(5)
|
||||
ws.run_forever()
|
||||
except KeyboardInterrupt:
|
||||
ws.close()
|
||||
|
|
Reference in a new issue