Skip to content

Commit

Permalink
Support degrade to watching mode in geo win
Browse files Browse the repository at this point in the history
  • Loading branch information
mayfield committed Apr 22, 2024
1 parent 38ba946 commit 929a278
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pages/src/geo.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ function setWatching(id) {


async function initialize() {
const ad = await common.rpc.getAthleteData('self');
let ad = await common.rpc.getAthleteData('self');
if (!ad) {
// Support file replay mode too...
ad = await common.rpc.getAthleteData('watching');
}
inGame = !!ad && ad.age < 15000;
if (!inGame) {
if (!demoState.intervalId) {
Expand Down Expand Up @@ -378,7 +382,7 @@ export async function main() {
fieldRenderer.render();
});
setInterval(() => {
if (inGame && performance.now() - watchdog > 10000) {
if (inGame && performance.now() - watchdog > 30000) {
console.warn("Watchdog triggered by inactivity");
inGame = false;
initialize();
Expand Down

0 comments on commit 929a278

Please sign in to comment.