Skip to content

Commit

Permalink
Fix potential race condition when saving sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
lmg-anon committed Dec 22, 2024
1 parent 2516553 commit c50fa87
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mikupad.html
Original file line number Diff line number Diff line change
Expand Up @@ -5223,10 +5223,11 @@
}

async saveSessionToDB(sessionId) {
if (!this.sessions[sessionId] || this.sessions[sessionId].inactive)
const sessionData = this.sessions[sessionId];
if (!sessionData || sessionData.inactive)
return;
const db = await this.openDatabase();
await this.saveToDatabase(db, sessionId, this.sessions[sessionId]);
await this.saveToDatabase(db, sessionId, sessionData);
}

async getNewId() {
Expand Down

0 comments on commit c50fa87

Please sign in to comment.