ollm / OpenComic

Comic and Manga reader, written with Node.js and using Electron
GNU General Public License v3.0
946 stars 80 forks source link

[Bug]: Search/filter buttons #256

Closed dajotim937 closed 1 month ago

dajotim937 commented 3 months ago

Preflight Checklist

OpenComic Version

1.2.0

Operating System

Win10, 22H2, build 19045

Steps to reproduce

image Top right buttons on header bar: Filter button (middle one) is actually search button. Search button (left one) is freezing app.

Expected Behavior

.

Actual Behavior

.

Error message

No response

Additional Information

No response

Sample file

No response

ollm commented 3 months ago

At first they work as expected, the filter button is used to search/filter the current folder, while the search button also does so in the current folder, but also searches in subfolders.

I've made some changes that should improve the speed of this second one 2686ff9a948a5086e65e2ade1cd00b0dacb7cef5

Build with changes: https://mega.nz/file/DDh2wJaR#pUhJMXeSUjJd99uTz6IDXI_fV5dhfl-0TKoela5IzoQ

dajotim937 commented 3 months ago

Search button still freezing app. In console there is bunch of messages:

readCompressed... *full path to file*

from C:\***\OpenComic\resources\app.asar\scripts\file-manager.js : 1078

So, looks like it's trying to check every file and since my library contains pretty good amount(1k+) of cbz files it takes long time to check them and result is freezed app.

UPD: I waited more that 8 mins to end this "readCompressed" and it was still going and at much slower pace than at the beginning. App was freezed all that time.

ollm commented 3 months ago

I'm going to change the approach to this feature, as it currently only works well when there are few files.

ollm commented 3 months ago

I have changed the approach of the search ca26c55c7c0c0374d104de60ba0d0628ccf85809 Previously, pressing the button would index all files first, which would freeze the app if there were a lot of them.

Now, it only starts indexing when you start typing, and when matches are found, indexing stops. I've also made some changes so that indexing doesn't freeze the app and can be cancelled at any time by closing the search.

Build: https://mega.nz/file/vH51hCCJ#bf7_HKVEXZM62BSHxFQkJa8CdDsG1VbbCho524udPT0

pein0saga commented 3 months ago

I have changed the approach of the search ca26c55 Previously, pressing the button would index all files first, which would freeze the app if there were a lot of them.

Now, it only starts indexing when you start typing, and when matches are found, indexing stops. I've also made some changes so that indexing doesn't freeze the app and can be cancelled at any time by closing the search.

Build: https://mega.nz/file/vH51hCCJ#bf7_HKVEXZM62BSHxFQkJa8CdDsG1VbbCho524udPT0

This works, but I still have "Error: incomplete frame" bug.

https://github.com/ollm/OpenComic/issues/258

dajotim937 commented 3 months ago

Now, it only starts indexing when you start typing, and when matches are found, indexing stops. I've also made some changes so that indexing doesn't freeze the app and can be cancelled at any time by closing the search.

Well, It's better, yes. But indexing still take a lot of time to be completed. Not that I need search in app (I encountered the issue by accident), but for my case it's basically useless.

2 coins from me:

  1. Search should make first round of search by filenames before indexing inside compressed files.
  2. Result even uncompleted search should be store somewhere, so search function won't index indexed files again.
ollm commented 3 months ago

Search should make first round of search by filenames before indexing inside compressed files.

I made this change for the search a141c1b4037d6dde36748a81f746c956d3414cd0

Result even uncompleted search should be store somewhere, so search function won't index indexed files again.

OpenComic already caches the list of files contained in a compressed file, and only re-reads the file if a modification is detected (If mtime date is different), If you see that you always have readCompressed... messages in the console, there may be a problem with the cache 774447d9ee072a275dfb7acf758dc5e285b9b8d7, either on the part of OpenComic or due to some other reason, I have also added in this build a function to lightly validate the cache, can be used on the console cache.validate(), the result would be similar to the following:

cache.validate()

Folders: 9
Compressed files: 11
Servers: 0
Images: 0

Validating cache of compressed files...
Correct: 11
Corrupted Zstd: 0
Corrupted Json: 0
Read Error: 0
Not in Cache: 0

Done

If you see the Correct number decrease and any of the others increase when you restart the App or OS, there may be a problem somewhere.

Buid: https://mega.nz/file/bXIVDIoA#CD5cbSrvd_3cON-oq0vhWSxJ3KVqkxfRtZaUl76KeJY

ollm commented 1 month ago

Closed as fixed and available in v1.3.0