Trikzon / obsidian-frontmatter-links

An Obsidian plugin that renders links in a note's frontmatter as links.
MIT License
64 stars 8 forks source link

Weird cache and indexing vault #18

Open Mara-Li opened 1 year ago

Mara-Li commented 1 year ago

Hello ;

On my vault, the plugin will add a big loading time during the cache reading. After this, Obsidian will ALWAYS reindex the vault.

This bug appear on Mobile and PC, vault is sync using Obsidian Sync.

I tryed with every plugin disabled, keeping only frontmatter links, and the issue persist. Note : My vault contains around 300 notes, with PDF, image, js files...

SYSTEM INFO: Obsidian version: v1.0.3 Installer version: v1.0.3 Operating system: Windows 10 Education 10.0.22623 Login status: logged in Catalyst license: insider Insider build toggle: on Live preview: on Legacy editor: off Base theme: light Community theme: AnuPpuccin Snippets enabled: 31 Restricted mode: off Plugins installed: 87 Plugins enabled: 3 1: Banners v1.3.3 2: Divide & Conquer v1.0.0 3: Frontmatter Links v1.2.6

RECOMMENDATIONS: Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets. Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

peterkehlerjr commented 1 year ago

I've been experiencing the same issue for a couple of days now. Took me a while to narrow it down to this plugin. It's a nice plug-in and I'm ooking forward to use it again after a fix.

Trikzon commented 1 year ago

In order to add frontmatter links to the graph, I process each note to see whether it has any links in the frontmatter when a note is reindexed.

I have never experienced performance problems with this, however, after my finals next week I can look into making this better performant.

The only times that the entire vault is told to reindex by this plugin is when it is enabled, when the "Add to graph" setting is toggled, and when a file is renamed and "Automatically update frontmatter internal links" is set to true.

I'm not sure its necessary anymore when a file is renamed, so I'll look into removing that after my finals, but once again, I never experienced lag from this so I assumed it was fine.

For now, if you'd like to use the rest of the features, I recommend that you disable the "Add to Graph" and "Automatically update frontmatter internal links" settings until it is fixed.

Mara-Li commented 1 year ago

I think it can be caused by syncing. Dunno how or why.

Good lucks for your exam !

tobiasvl commented 1 year ago

I use Obsidian Sync and I've also experienced reindexing of the cache every time I launched Obsidian, although I haven't suspected this plugin until now.

ArtemisFowl-san commented 1 year ago

I've had the same problem for a couple of days. Really like the plug in and hope this can be fixed :) Thanks for your efforts in any case

mktwohy commented 1 year ago

I also use Obsidian Sync and have narrowed down the issue to this plugin. Every time the app loads, Obsidian re-indexes

svenluijten commented 1 year ago

This also happens when syncing via iCloud, not just Obsidian Sync. Every time I open the mobile app (iOS and iPadOS) with this plugin enabled, it shows me that Obsidian is re-indexing the entire vault.

While this doesn't cause me any lag, it is mildly annoying.

image

Disabling the "Add to graph" config option solves the issue for now 😀

elzik commented 1 year ago

I have same issue with this plugin and can also confirm that disabling the "Add to graph" config option is a workaround.

pvojtechovsky commented 1 year ago

@Trikzon today I debugged the obsidian code around parsing of markdown and creating/updating of metadataCache. I found that you modify metadataCache records after its copy is saved in IDBDatabase. It causes inconsitency between memory content of the metadataCache and it's persistent copy in IDBDatabase.

There is a chance that this inconsistency causes need for reparsing of markdown files and long startup times.

May be the solution would be to not listen on metadataCache change but directly hook on metadataCache.saveMetaCache(...) method. If you modify the cache (add links from frontmatter) before the origin implementation is called, then the memory and IDBDatabase will be consistent and you do not need to search for links in frontmatter with each start of obsidian, because it will be loaded from IDBDatabase correctly.

Are you going to try it? What next steps do would you suggest/like?