MediaElch icon indicating copy to clipboard operation
MediaElch copied to clipboard

Excluding folders from refresh at startup creates dupllicates

Open ozorfis opened this issue 3 years ago • 3 comments

Describe the bug Whenever I exclude one or all folders from refresing at startup the app either doesn´t list my entire library or creates duplicates. When I allow it to scan all folders it works as expected.

To Reproduce Steps to reproduce the behavior:

  1. Go to '.Settings' Global
  2. Click on 'exclude folder on startup'

Expected behavior List the entire library without duplicates.

Screenshots If applicable, add screenshots to help explain your problem.

MediaElch Version:

  • [ ] 2.8.19-dev (nightly)
  • [ x] 2.8.18 stable

Operating System:

  • [ x] Windows
  • [ ] macOS
  • [ ] Linux (distribution: .)

Additional context I had this occasionally in earlier versions but now it is permanent. Also the "MediaElch.sqlite" gets bigger and bigger on every startup without anything added. Deleting the "MediaElch.sqlite" did not help.

ozorfis avatar Nov 02 '22 03:11 ozorfis

Hi,

thanks for reporting this issue.

Also the "MediaElch.sqlite" gets bigger and bigger on every startup without anything added.

Oh, that doesn't sound right. Out of curiosity, how big is the SQLite file?

I will look into it soon. Due to limited time on my side, it may take a week or two, before I get back to you. After that, feel free to ping me again.

Regards, Andre

bugwelle avatar Nov 06 '22 11:11 bugwelle

Hi,

many thanks for picking up the issue. The SQLite is 290 Mb right now, it was 1Gb before I deleted it. Each start up seems to add 30 Mb on top. Take your time I can scan each folder, so it is still useable. I just don´t want to wake up every hard drive when I start the app.

Best regards Florian

ozorfis avatar Nov 06 '22 15:11 ozorfis

Maybe there is a connection to #1489. Now using MediaElch 2.8.19-dev - Coridian this issue remains.

Reloading each folder on startup works. Excluding a folder from reloading will cause it to get stuck and create duplicates.

screenshot

ozorfis avatar Nov 13 '22 19:11 ozorfis

The "getting stuck"-issue was fixed by https://github.com/Komet/MediaElch/pull/1510

I found the issue: If "auto-reload" is enabled, the database is not cleared. It creates duplicates for that folder.

A manual "reload" fixes the huge database size. I have 986 movies in my test database, and each start of MediaElch adds that amount to the database. Depending on the number of movies, this can get huge very soon.

❯ sqlite3 MediaElch.sqlite
SQLite version 3.40.0 2022-11-16 12:10:08
Enter ".help" for usage hints.
sqlite> SELECT COUNT(*) as n FROM movies;
2904
sqlite> SELECT COUNT(*) as n FROM movies;
3872
sqlite> 

My small test database grew from 7MiB to 32MiB just after a few restarts.

Thank you very much for reporting this issue!

bugwelle avatar Dec 26 '22 12:12 bugwelle

This issue was fixed by #1517. Note that you may want to run VACUUM; on the SQLite3 database if you want to shrink its size:

❯ sqlite3 MediaElch.sqlite                                
SQLite version 3.40.0 2022-11-16 12:10:08
Enter ".help" for usage hints.
sqlite> VACUUM;
sqlite> 

Thank you very much for reporting this issue! I nearly marked it as "can't reproduce", but the hint towards "autoReload" helped. I wouldn't have found this bug without your help, so thanks! :)

bugwelle avatar Dec 26 '22 13:12 bugwelle

Glad that I could be of help blush - thank you for fixing it :)

ozorfis avatar Dec 26 '22 14:12 ozorfis