Skip to content
Merged
Changes from 2 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
32 changes: 16 additions & 16 deletions deep-sea-stories/packages/backend/src/game/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,28 +200,28 @@ export class GameRoom {
this.gameTimeoutId = null;
}

if (this.gameSession) {
await this.gameSession.stopGame(wait);
try {
try {
if (this.gameSession) {
await this.gameSession.stopGame(wait);
await this.fishjamClient.deletePeer(
this.roomId,
this.gameSession.agentId,
);
this.gameSession = null;
} catch (e) {
if (!(e instanceof PeerNotFoundException)) throw e;
}
} catch (e) {
if (!(e instanceof PeerNotFoundException)) throw e;
} finally {
this.gameSession = null;
this.story = undefined;

this.notifierService.emitNotification(this.roomId, {
type: 'gameEnded' as const,
timestamp: Date.now(),
});

this.gameStarted = false;
console.log(`Stopped game for room ${this.roomId}`);
}

this.story = undefined;

this.notifierService.emitNotification(this.roomId, {
type: 'gameEnded' as const,
timestamp: Date.now(),
});

this.gameStarted = false;
console.log(`Stopped game for room ${this.roomId}`);
}

private async createFishjamAgent() {
Expand Down