franciskafieh / obsidian-list-modified

🪨 The advanced and adaptive changelog for Obsidian. Links all modified files meeting certain criteria to a timed (daily, weekly, monthly) note.
MIT License
85 stars 7 forks source link

[BUG] Obsidian freezes when thousands of files were modified today #83

Closed nununo closed 4 months ago

nununo commented 1 year ago

First Steps

Describe the bug

If thousands of files are modified today, Obsidian will freeze for a long time (sometimes forever?) some seconds or minutes after a modification is done on a note.: the keyboard no longer works and the mouse can scroll but cannot click.

Expected behaviour

No freeze.

Reproducing

My setup

Steps to reproduce bug

I created a new vault as copy of another one (since I was migrating from Obsidian Sync to iCloud). The vault has over 5k notes. All of the notes were considered modified and the list written to my daily note included every single one of them.

Additional info?

I disabled every plugin except this one to make sure no other plugins were confounding its behaviour. Also, if this plugin is disabled, the problem doesn't happen, regardless of what other plugins are active.

nununo commented 1 year ago

Ok I think I may have understood what the problem is: I just found that the list of modified files in my daily note is over 5k. That got me thinking: yesterday, at the same time I upgraded to v1.2.5, I was trying to migrate from Obsidian Sync to iCloud which required me creating a new vault. Since I have over 5k files... well... it considered that all the files were modified. So, most probably, this freeze is related to the plugin writing all the 5k changed files to my daily note.

So... well... maybe this isn't a bug after all. Still, this is an odd behaviour. Would it be possible to do this is background (much like how Obsidian indexes the vault)?

nununo commented 1 year ago

I just rewrote the whole bug to reflect my new conclusions. Since the original text was misleading.

nununo commented 1 year ago

As a workaround I guess I will remember to disable this plugin for 24h when migrating large vaults.

franciskafieh commented 1 year ago

Going to look into this. Might be impossible to fix as writing 5000 lines to a file needs processing power. But maybe there is a way to do it all in the background?

franciskafieh commented 4 months ago

To be honest, I don't think there is a way to do this in the background. Since it only happens when migrating sync solutions, it's not a super big priority right now. If you would like to add on to this, or if someone else has the same issue, please reopen.

In that case, I would probably have to add a small delay after each file modification to check how many files are enqueued to be added to the daily note. If there's a lot (probably >~50), assume it's a sync thing and don't write to the file.