Remove entries from cache if their filename does not exist.
ClosedPublic

Authored by woltherav on Sep 25 2018, 1:36 PM.

Details

Summary

This checks if the filename exists, and if not, removes the entry from the database.

This would be a fix to https://bugs.kde.org/show_bug.cgi?id=398260

Test Plan
  1. Install sqlitebrowser.
  2. Check peruse's cache in sqlitebrowser for a comic you want to remove.
  3. Remove said comic from the folders.
  4. Start peruse. Observe that it is telling you it is removing that entry from the cache.
  5. Recheck the cache in sqlitebrowser to confirm said entry has been removed.

Diff Detail

Repository
R157 Peruse
Lint
Lint Skipped
Unit
Unit Tests Skipped
woltherav requested review of this revision.Sep 25 2018, 1:36 PM
woltherav created this revision.

The reason i didn't do this before is that it does file system access, which is precisely what the cache is supposed to try to avoid... You've got a large collection, right? What sort of impact does this have on load time? (baloo shouldn't matter in this case, but it's good to test with that turned off anyway...)

Well, the thing is, I have a large collection(sqlitebrowser counts about 586 entries right now), yes, but I also have a fairly beefy computer. Starting peruse with clear-db takes way longer than this(which is near instantaneous), but because I have a beefy computer I suspect it might be the debug messages that is the major cause of the slowdown with clear-db. Either someone with a slow harddrive should check this, or I'll drop the patch and wait for one that is theoretically speedier.

Well, the thing is, I have a large collection(sqlitebrowser counts about 586 entries right now), yes, but I also have a fairly beefy computer. Starting peruse with clear-db takes way longer than this(which is near instantaneous), but because I have a beefy computer I suspect it might be the debug messages that is the major cause of the slowdown with clear-db. Either someone with a slow harddrive should check this, or I'll drop the patch and wait for one that is theoretically speedier.

One way to check for speed of this sort of stuff is to stick things on an SD card and point Peruse at that... those things are dog slow, handy for testing what's actually heavy :) (because yeah, i've got an SSD in this machine, which is similarly useless for testing IO impact...)

woltherav added a comment.EditedSep 25 2018, 1:53 PM

hm... will have to chase down an sd card reader first :D

(Or someone should check on windows...)

woltherav updated this revision to Diff 42307.Sep 25 2018, 2:07 PM

This changes to QFileInfo::exists(filename), because the docs say that is a little faster.

Also put it under removebook where it makes most sense.

leinir accepted this revision.Sep 25 2018, 2:08 PM

Good stuff, let's roll with this one :)

This revision is now accepted and ready to land.Sep 25 2018, 2:08 PM
This revision was automatically updated to reflect the committed changes.