Fast vault load, especially after initial indexing
No unnecessary reindexing
Actual result
Vault load time is ~3 min
Vault reindexing is happening on every vault load
Vault reindexing time is ~27 min
Environment
SYSTEM INFO:
Operating system: android 12 (OnePlus HD1913)
Obsidian version: 1.7.1 (162)
API version: v1.7.1
Login status: not logged in
Language: en
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on
RECOMMENDATIONS:
none
It shows load time as 314 seconds = 5 minutes, however it doesn’t show that the vault indexing takes another 30-40 minutes . I don’t see why the index is not being saved.
BTW, the phone battery is heavily drained. The phone is connected to the computer, but the phone consumes more energy than gets from the computer.
Regarding errors console, the only I have:
app.js:1 Capacitor plugin "Keyboard" already registered. Cannot register plugins twice.
app.js:1 M: Directory does not exist
at returnResult (http://localhost/:915:32)
at win.androidBridge.onmessage (http://localhost/:890:21)
I also noticed but I am not sure if it means anything
app.vault.adapter.dir is null
According to my reverse engineering of your obfuscated code, it supposed to be a string, rather than null.
I’ve done more research for different sizes of vault. I just created thousands of empty md files to see when the cache is stopped being stored
On 25k files I found that if you close the Obsidian app soon after Indexing complete message disappears and then reopen the app, it starts reindexing from scratch.
If you wait long enough before closing the Obsidian app, the index is saved to the file and reindexing not happening.
Sometimes I get the intermediate result but I don’t know how to get it consistently. Sometimes after reopening the app, only part of the files are being reindexed.
It seems that writing to the IndexedDB is happening asynchronously and UI has no visible indicator of this process, so closing the app before it’s done, loses the index (fully or partially).
In my opinion, you need to show Indexing completed message only after IndexedDB is written down.
I am trying to find the exact amount of files where the indexing is stuck (or maybe takes more time than my patience allows)
I did some experimenting tonight. We believe that the problem lies in the fact that that the indexeddb transactions are not actually flushed to disk when they are complete (even when using strict mode).
Unfortunately, we have no way on knowing when the process is truly done.
The good news is that the process is incremental, so you will make progress every time you use obsidian.
There are two tables that are created the first time you add vault.
files (populated during load workspace) and
metadata constructed during indexing.
You are observing “indexing” restarting from zero because the preceding file table isn’t finished yet. Once file is complete, loading workspace becomes fast, and you will start see progress being made (saved) on metadata during indexing.
If it hangs forever what would we be even checking for?
I think from the amount of debugging you provided we can conclude this is an indexeddb issue (possibly just the chromium/android web view implementation), and there doesn’t seem like there is any API that we can leverage to force it to behave the way we want.
I understand we can’t force it to save, but having a visual indicator that the saving is still taking place and potentially showing the warning if you try to exit before it’s done, would improve the UX
To be honest I don’t think it’s worth attempting to address given the situation is more of an edge case and the rest of the app is pretty much non-functionally slow anyway, that it wouldn’t practically achieve anything. Maybe by the time devices gets fast enough to handle vaults of this size the chromium team would have already improved the indexeddb perf, or introduced APIs to handle this better. For now I think it’s just unpractical, like your title say.