- commit
- b9d12be2a7ea5dd47f028f139d7551c96182b4d3
- parent
- 1c7a1df6cc0ea5029c5a270b9273a6136d1f69d3
- author
- dami <gazey55@gmail.com>
| M | site/ | 15 | +++++++++++---- |
@@ -257,11 +257,18 @@ if (args.join) {
257257 });258258 gameId = started.game_id;259259 console.log("game", gameId, started.status ?? "");260- // generation runs in the background: poll until the field is playing260+ // generation runs in the background: poll list_games until the field is261+ // playing (observe without a scope is refused on large fields)261262 for (;;) {262- const o = (await call("observe", { game_id: gameId })).observation;263- if (o.status === "failed") throw new Error("generation failed");264- if (o.status !== "generating") break;263+ const games = (await call("list_games", {})).games as {264+ game_id: string;265+ status: string;266+ error?: string;267+ }[];268+ const g = games.find((x) => x.game_id === gameId);269+ if (!g) throw new Error("game vanished");270+ if (g.status === "failed") throw new Error(`generation failed: ${g.error}`);271+ if (g.status !== "generating") break;265272 await new Promise((r) => setTimeout(r, 2000));266273 }267274 }