Skip to content

Configure nedb to always clean up corrupted data - #8202

Merged
FreeTubeBot merged 1 commit into
FreeTubeApp:developmentfrom
absidue:nedb-corrupt-data-cleanup
Nov 2, 2025
Merged

FreeTubeBot merged 1 commit into
FreeTubeApp:developmentfrom
absidue:nedb-corrupt-data-cleanup

Conversation

@absidue

@absidue absidue commented Oct 31, 2025

Copy link
Copy Markdown
Member

Pull Request Type

  • Bugfix

Related issue

Description

If the FreeTube databases get corrupted by a sudden computer shutdown e.g. a power outage, nedb will refuse to open the database if 10% or more is corrupted, below that threshold it cleans up the corrupted data and continues as if it were never there. In those situations we currently tell users to manually edit the database files and remove the corrupted parts. This pull request changes nedb's corruptAlertThreshold configuration from 0.1 (the default) to 1, so it will always clean up corrupted data, this saves users having to manually edit the databases.

As the nedb new Datastore() lines were getting quite long and most of the parameters are the same for all databases, I decided to move it to a function that takes the database name.

Testing

  1. Make sure FreeTube isn't running
  2. Back up your FreeTube databases from the data location (https://docs.freetubeapp.io/usage/data-location/)
  3. Delete parts from various entries/lines in one of the databases in a text editor
  4. Start FreeTube
  5. It should start normally, just missing the corrupted records

Desktop

  • OS: Windows
  • OS Version: 11

@FreeTubeBot
FreeTubeBot enabled auto-merge (squash) October 31, 2025 18:14
@github-actions github-actions Bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Oct 31, 2025
@FreeTubeBot
FreeTubeBot merged commit 293ea3f into FreeTubeApp:development Nov 2, 2025
@github-actions github-actions Bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Nov 2, 2025
@absidue
absidue deleted the nedb-corrupt-data-cleanup branch November 2, 2025 09:09
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Nov 3, 2025
* development: (325 commits)
  Replace vue-portal dependency with Vue's built-in <Teleport> component (FreeTubeApp#8207)
  Update to Vue 3 (FreeTubeApp#8094)
  Translated using Weblate (Basque)
  Translated using Weblate (Hungarian)
  Translated using Weblate (Icelandic)
  Translated using Weblate (Turkish)
  Properly fix CORS in PO token web views (FreeTubeApp#8203)
  Translated using Weblate (Italian)
  Translated using Weblate (Norwegian Bokmål)
  Translated using Weblate (French)
  Configure nedb to always clean up corrupted data (FreeTubeApp#8202)
  Translated using Weblate (Portuguese (Brazil))
  Add video paused check to frame shortcuts (FreeTubeApp#8200)
  Fix toast with timeout 0 will be displayed for default 3s (FreeTubeApp#8168)
  Translated using Weblate (Chinese (Simplified Han script))
  Change containing text input limit (FreeTubeApp#8174)
  Translated using Weblate (Dutch)
  Add support for AppImageUpdate (FreeTubeApp#8153)
  Added New Window option to Tray (FreeTubeApp#7995)
  Translated using Weblate (Japanese)
  ...
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Nov 3, 2025
* development: (21 commits)
  Replace vue-portal dependency with Vue's built-in <Teleport> component (FreeTubeApp#8207)
  Update to Vue 3 (FreeTubeApp#8094)
  Translated using Weblate (Basque)
  Translated using Weblate (Hungarian)
  Translated using Weblate (Icelandic)
  Translated using Weblate (Turkish)
  Properly fix CORS in PO token web views (FreeTubeApp#8203)
  Translated using Weblate (Italian)
  Translated using Weblate (Norwegian Bokmål)
  Translated using Weblate (French)
  Configure nedb to always clean up corrupted data (FreeTubeApp#8202)
  Translated using Weblate (Portuguese (Brazil))
  Add video paused check to frame shortcuts (FreeTubeApp#8200)
  Fix toast with timeout 0 will be displayed for default 3s (FreeTubeApp#8168)
  Translated using Weblate (Chinese (Simplified Han script))
  Change containing text input limit (FreeTubeApp#8174)
  Translated using Weblate (Dutch)
  Add support for AppImageUpdate (FreeTubeApp#8153)
  Added New Window option to Tray (FreeTubeApp#7995)
  Translated using Weblate (Japanese)
  ...
PikachuEXE added a commit to NishPatel101/FreeTube that referenced this pull request Nov 3, 2025
* development: (38 commits)
  Replace vue-portal dependency with Vue's built-in <Teleport> component (FreeTubeApp#8207)
  Update to Vue 3 (FreeTubeApp#8094)
  Translated using Weblate (Basque)
  Translated using Weblate (Hungarian)
  Translated using Weblate (Icelandic)
  Translated using Weblate (Turkish)
  Properly fix CORS in PO token web views (FreeTubeApp#8203)
  Translated using Weblate (Italian)
  Translated using Weblate (Norwegian Bokmål)
  Translated using Weblate (French)
  Configure nedb to always clean up corrupted data (FreeTubeApp#8202)
  Translated using Weblate (Portuguese (Brazil))
  Add video paused check to frame shortcuts (FreeTubeApp#8200)
  Fix toast with timeout 0 will be displayed for default 3s (FreeTubeApp#8168)
  Translated using Weblate (Chinese (Simplified Han script))
  Change containing text input limit (FreeTubeApp#8174)
  Translated using Weblate (Dutch)
  Add support for AppImageUpdate (FreeTubeApp#8153)
  Added New Window option to Tray (FreeTubeApp#7995)
  Translated using Weblate (Japanese)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants