Fix checksum status reset bug preventing unnecessary recalculation on restart - #25
Merged
Merged
Conversation
…necessary recalculation on restart - Modified cacheItemInfoWithStats to check existing database records before updating - Preserve existing checksum_status instead of always setting to 'pending' - Only queue checksums when actually needed (new files, changed files, or failed checksums) - Matches intelligent behavior of cacheItemInfoWithLookup method - Fixes bug where 3,324+ files were reset from 'complete' to 'pending' on restart - Root cause: chokidar ignoreInitial:false emits add events for existing files during startup Co-Authored-By: mark.gilbert@prominic.net <mark.gilbert@prominic.net>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix checksum status reset bug preventing unnecessary recalculation on restart
Summary
Fixed a critical performance bug where the file watcher was resetting checksum status from
completetopendingfor thousands of existing files on every application restart, causing massive unnecessary checksum recalculation.Root Cause: The
cacheItemInfoWithStatsmethod (triggered by chokidar'saddevents for existing files during startup withignoreInitial: false) was always settingchecksum_status: 'pending', overwriting the correctcompletestatus that was preserved during initial directory scan.Solution: Modified
cacheItemInfoWithStatsto:checksum_statusinstead of always setting topendingcacheItemInfoWithLookupReview & Testing Checklist for Human
SELECT COUNT(*) as total, checksum_status FROM files GROUP BY checksum_status- should show minimalpendingfiles after restart)findOnecalls per fileNotes
This change affects a critical system component and adds database queries during startup. The fix prevents thousands of unnecessary checksum calculations (user reported 3,324 files being reset to
pendingon restart) but introduces per-file database lookups during chokidar initialization.Link to Devin run: https://app.devin.ai/sessions/a84f1763f38f47c7a556fc6af605272c
Requested by: @MarkProminic