Skip to content

Commit

Permalink
update onBeforeShutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed Nov 12, 2024
1 parent 36ccc66 commit d6c565a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/backend/src/rooms/MyRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,17 @@ export class MyRoom extends Room<MyRoomState> {
console.log("room", this.roomId, "disposing...");
}

/**
* When shutting down the process:
* - broadcast a message to all clients
* - wait 30 seconds before allowing the process to shutdown
*/
onBeforeShutdown() {
this.broadcast("going-away");

this.clock.setTimeout(() => {
this.disconnect();
}, 10 * 1000);
}, 30 * 1000);
}

}

0 comments on commit d6c565a

Please sign in to comment.