Skip to content

Commit 83a5491

Browse files
black-sliverqwint
authored andcommitted
Test: hosting: handle writes during start_room (ArchipelagoMW#3492)
Note: maybe we'd also want to add such handling to WebHost itself, but this is out of scope for getting hosting test to work.
1 parent d2fe295 commit 83a5491

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/hosting/webhost.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,19 @@ def create_room(app_client: "FlaskClient", seed: str, auto_start: bool = False)
6666
def start_room(app_client: "FlaskClient", room_id: str, timeout: float = 30) -> str:
6767
from time import sleep
6868

69+
import pony.orm
70+
6971
poll_interval = .2
7072

7173
print(f"Starting room {room_id}")
7274
no_timeout = timeout <= 0
7375
while no_timeout or timeout > 0:
74-
response = app_client.get(f"/room/{room_id}")
76+
try:
77+
response = app_client.get(f"/room/{room_id}")
78+
except pony.orm.core.OptimisticCheckError:
79+
# hoster wrote to room during our transaction
80+
continue
81+
7582
assert response.status_code == 200, f"Starting room for {room_id} failed: status {response.status_code}"
7683
match = re.search(r"/connect ([\w:.\-]+)", response.text)
7784
if match:

0 commit comments

Comments
 (0)