Or, you know, write sensible code.
This commit is contained in:
parent
c00efa0884
commit
ffa2895157
1 changed files with 24 additions and 28 deletions
|
@ -263,20 +263,14 @@ def post_registerCheck() -> Any:
|
|||
|
||||
now_time = datetime.datetime.now()
|
||||
|
||||
connection: Optional[Connection] = None
|
||||
for conn in connections:
|
||||
if content["timeslotid"] == conn["timeslotid"]:
|
||||
# they've already registered, return the existing session
|
||||
# but first, check if it has a nulled-out wsID
|
||||
# TODO: duplicate of fragment below
|
||||
if "wsid" in content:
|
||||
conn["wsid"] = content["wsid"]
|
||||
if start_time + datetime.timedelta(minutes=2) < now_time:
|
||||
# they're late, bring them live now
|
||||
print("({}, {}) rejoined late, bringing on air now".format(conn["connid"], conn["wsid"]))
|
||||
do_ws_srv_telnet(conn["wsid"])
|
||||
subprocess.Popen(['sel', '5'])
|
||||
return genPayload(conn)
|
||||
print("found existing connection {} for {}".format(conn["connid"], conn["timeslotid"]))
|
||||
connection = conn
|
||||
|
||||
if connection is None:
|
||||
if start_time - now_time > datetime.timedelta(hours=1):
|
||||
return genFail("This show too far away, please try again within an hour of starting your show.")
|
||||
|
||||
|
@ -298,6 +292,7 @@ def post_registerCheck() -> Any:
|
|||
'autoNewsEnd': True,
|
||||
'wsid': None
|
||||
}
|
||||
|
||||
if "wsid" in content:
|
||||
connection["wsid"] = content["wsid"]
|
||||
if start_time + datetime.timedelta(minutes=2) < now_time:
|
||||
|
@ -306,6 +301,7 @@ def post_registerCheck() -> Any:
|
|||
do_ws_srv_telnet(connection["wsid"])
|
||||
subprocess.Popen(['sel', '5'])
|
||||
|
||||
assert connection is not None
|
||||
connections.append(connection)
|
||||
print(connections)
|
||||
|
||||
|
|
Loading…
Reference in a new issue