Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lobbies): await poll servers in tick in order to cleanly throw error #596

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading