Skip to content

Commit

Permalink
chore(lobbies): await poll servers in tick in order to cleanly throw …
Browse files Browse the repository at this point in the history
…error
  • Loading branch information
NathanFlurry committed Sep 30, 2024
1 parent 03cb766 commit d0615db
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions modules/lobbies/actors/lobby_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const ENABLED_BUILD_TAG = "enabled";

const TICK_INTERVAL = 1000;
const GC_INTERVAL = 15 * 1000;
const POLL_SERVERS_INTERVAL = 1 * 1000;
const POLL_SERVERS_INTERVAL = 1000;

const EVENT_KEYS = {
lobbyUpdate(lobbyId: string): string {
Expand Down Expand Up @@ -1148,7 +1148,7 @@ export class Actor extends ActorBase<undefined, State.StateVersioned> {
}
}

private tick(ctx: ActorContext) {
private async tick(ctx: ActorContext) {
this.schedule.after(TICK_INTERVAL, "tick", undefined);

const now = Date.now();
Expand All @@ -1158,7 +1158,7 @@ export class Actor extends ActorBase<undefined, State.StateVersioned> {
}
if (now - this.currentState.lastServerPollAt >= POLL_SERVERS_INTERVAL) {
this.currentState.lastServerPollAt = now;
this.pollServers(ctx);
await this.pollServers(ctx);
}
}

Expand Down
2 changes: 1 addition & 1 deletion sandbox/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ window.findOrCreateLobby = async function() {
const regions = await getBackend().lobbies.listRegions({});

// const region = regions.regions[0].slug;
const region = 'lnd-atl';
const region = 'atl';
const tags = {};
let res = await getBackend().lobbies.findOrCreate({
version: localStorage.gameVersion ?? "default",
Expand Down
2 changes: 1 addition & 1 deletion sandbox/rivet.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"ports": {
"game": {
"protocol": "http",
"protocol": "https",
"internalPort": 7777
}
},
Expand Down

0 comments on commit d0615db

Please sign in to comment.