[PR #4385] [MERGED] Update cleanDatabase to remove duplicate mediaProgresses #4233

Closed
opened 2026-04-25 00:18:55 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4385
Author: @advplyr
Created: 6/7/2025
Status: Merged
Merged: 6/7/2025
Merged by: @advplyr

Base: masterHead: clean_duplicate_mediaprogress


📝 Commits (1)

  • 8164046 Update cleanDatabase to remove duplicate mediaProgresses

📊 Changes

1 file changed (+9 additions, -0 deletions)

View changed files

📝 server/Database.js (+9 -0)

📄 Description

Brief summary

Adds a step in the clean database function to remove duplicate mediaProgresses entries

Which issue is fixed?

No issue, but related to #4366 and probably others. This is often brought up in Discord.

In-depth Description

A race condition in the API when syncing sessions and/or creating media progress can result in multiple media progress records with the same mediaItemId. So far this is only seen with the third party app Plappa.

This PR doesn't fix that issue but it will clean up the duplicates on server startup.

How have you tested this?

Created duplicates in the db manually


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/4385 **Author:** [@advplyr](https://github.com/advplyr) **Created:** 6/7/2025 **Status:** ✅ Merged **Merged:** 6/7/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `clean_duplicate_mediaprogress` --- ### 📝 Commits (1) - [`8164046`](https://github.com/advplyr/audiobookshelf/commit/81640464ba71a917d199a885f86658ea38a9fb5a) Update cleanDatabase to remove duplicate mediaProgresses ### 📊 Changes **1 file changed** (+9 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `server/Database.js` (+9 -0) </details> ### 📄 Description <!-- For Work In Progress Pull Requests, please use the Draft PR feature, see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details. If you do not follow this template, the PR may be closed without review. Please ensure all checks pass. If you are a new contributor, the workflows will need to be manually approved before they run. --> ## Brief summary Adds a step in the clean database function to remove duplicate `mediaProgresses` entries ## Which issue is fixed? No issue, but related to #4366 and probably others. This is often brought up in Discord. ## In-depth Description A race condition in the API when syncing sessions and/or creating media progress can result in multiple media progress records with the same `mediaItemId`. So far this is only seen with the third party app Plappa. This PR doesn't fix that issue but it will clean up the duplicates on server startup. ## How have you tested this? Created duplicates in the db manually --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:18:55 +02:00
adam closed this issue 2026-04-25 00:18:56 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4233