stateserver: troubleshoot registering

This commit is contained in:
Marks Polakovs 2020-04-14 10:11:02 +02:00
parent bf774bae11
commit e37ce21b62

View file

@ -324,6 +324,7 @@ def post_settingsCheck() -> Any:
def post_wsSessions() -> Any: def post_wsSessions() -> Any:
global connections global connections
global wsSessions global wsSessions
global lastConnectionIDToRegister
content = request.json content = request.json
# if not content: # if not content:
# return genFail("No parameters provided.") # return genFail("No parameters provided.")
@ -349,13 +350,17 @@ def post_wsSessions() -> Any:
if conn["connid"] == lastConnectionIDToRegister: if conn["connid"] == lastConnectionIDToRegister:
if conn["wsid"] is None and len(wsids_to_add) == 1: if conn["wsid"] is None and len(wsids_to_add) == 1:
conn["wsid"] = wsids_to_add[0] conn["wsid"] = wsids_to_add[0]
print("({}, {}) hello".format(conn["connid"], conn["wsid"]))
if conn["wsid"] in wsids_to_add: if conn["wsid"] in wsids_to_add:
if conn["startTimestamp"] + 120 < datetime.datetime.now().timestamp(): if conn["startTimestamp"] + 120 < datetime.datetime.now().timestamp():
# they're late, bring them on air now # they're late, bring them on air now
print("({}, {}) late, bringing on air now".format(conn["connid"], conn["wsid"]))
do_ws_srv_telnet(conn["wsid"]) do_ws_srv_telnet(conn["wsid"])
subprocess.Popen(['sel', '5']) subprocess.Popen(['sel', '5'])
if conn["wsid"] in wsids_to_remove: if conn["wsid"] in wsids_to_remove:
print("({}, {}) gone".format(conn["connid"], conn["wsid"]))
conn["wsid"] = None conn["wsid"] = None
# TODO Make this actually do a disconnect sequence if this is the current show. # TODO Make this actually do a disconnect sequence if this is the current show.
# time.sleep(5) # time.sleep(5)