vrtmrz / obsidian-livesync

MIT License
3.93k stars 132 forks source link

Hidden File Sync Always Triggered After Changing Device #374

Closed virusperfect closed 3 months ago

virusperfect commented 5 months ago

Abstract

The synchronization works perfectly, but everytime I switch device, the hidden files get reloaded for some reason even if I don't change anything.

Expected behaviour

Actually happened

Reproducing procedure

  1. Open Obsidian on the first device and save everything.
  2. Open Obsidian on the second device and wait for the above mentioned message.
  3. Reload Obsidian on the second device.
  4. Obsidian on the first device will now resync and display the reload message.
  5. After reloading Obsidian on the first device the message gets displayed on the second device and so on.

Report materials

Report from the LiveSync

Report from hatch ``` ---- Obsidian info ---- Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) obsidian/1.5.3 Chrome/114.0.5735.289 Electron/25.8.1 Safari/537.36 ---- remote config ---- cors: credentials: "true" headers: accept, authorization, content-type, origin, referer max_age: "3600" methods: GET,PUT,POST,HEAD,DELETE origins: app://obsidian.md,capacitor://localhost,http://localhost chttpd: bind_address: any enable_cors: "true" max_http_request_size: "4294967296" port: "5984" require_valid_user: "true" admins: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 vendor: name: The Apache Software Foundation feature_flags: partitioned||*: "true" chttpd_auth: authentication_redirect: /_utils/session.html hash_algorithms: sha256, sha require_valid_user: "true" indexers: couch_mrview: "true" prometheus: additional_port: "false" bind_address: 127.0.0.1 port: "17986" httpd: WWW-Authenticate: Basic realm="couchdb" bind_address: 0.0.0.0 enable_cors: "true" port: "5986" smoosh: state_dir: ./data couch_httpd_auth: authentication_db: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 secret: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 authentication_redirect: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 couchdb_engines: couch: couch_bt_engine couchdb: database_dir: ./data max_document_size: "50000000" single_node: "true" uuid: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 view_index_dir: ./data ---- Plug-in config --- version:0.22.4 couchDB_URI: self-hosted couchDB_USER: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 couchDB_PASSWORD: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 couchDB_DBNAME: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 liveSync: true syncOnSave: false syncOnStart: false savingDelay: 200 lessInformationInLog: false gcDelay: 0 versionUpFlash: "" minimumChunkSize: 20 longLineThreshold: 250 showVerboseLog: false suspendFileWatching: false trashInsteadDelete: true periodicReplication: false periodicReplicationInterval: 60 syncOnFileOpen: false encrypt: true passphrase: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 usePathObfuscation: true doNotDeleteFolder: true resolveConflictsByNewerFile: false batchSave: false deviceAndVaultName: "" usePluginSettings: false showOwnPlugins: false showStatusOnEditor: true showOnlyIconsOnEditor: false usePluginSync: false autoSweepPlugins: false autoSweepPluginsPeriodic: false notifyPluginOrSettingUpdated: false checkIntegrityOnSave: false batch_size: 50 batches_limit: 40 useHistory: true disableRequestURI: true skipOlderFilesOnSync: true checkConflictOnlyOnOpen: false showMergeDialogOnlyOnActive: false syncInternalFiles: true syncInternalFilesBeforeReplication: false syncInternalFilesIgnorePatterns: \/node_modules\/, \/\.git\/, \/obsidian-livesync\/,\/workspace$ ,\/workspace.json$,\/workspace-mobile.json$ syncInternalFilesInterval: 60 additionalSuffixOfDatabaseName: "" ignoreVersionCheck: false lastReadUpdates: 22 deleteMetadataOfDeletedFiles: false syncIgnoreRegEx: "" syncOnlyRegEx: "" customChunkSize: 100 readChunksOnline: true watchInternalFileChanges: true automaticallyDeleteMetadataOfDeletedFiles: 0 disableMarkdownAutoMerge: false writeDocumentsIfConflicted: false useDynamicIterationCount: false syncAfterMerge: false configPassphraseStore: "" encryptedPassphrase: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 encryptedCouchDBConnection: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 permitEmptyPassphrase: false useIndexedDBAdapter: true useTimeouts: false writeLogToTheFile: false doNotPaceReplication: false hashCacheMaxCount: 300 hashCacheMaxAmount: 50 concurrencyOfReadChunksOnline: 100 minimumIntervalOfReadChunksOnline: 333 hashAlg: xxhash64 suspendParseReplicationResult: false doNotSuspendOnFetching: false useIgnoreFiles: false ignoreFiles: .gitignore syncOnEditorSave: false pluginSyncExtendedSetting: {} syncMaxSizeInMB: 50 settingSyncFile: "" writeCredentialsForSettingSync: false notifyAllSettingSyncFile: false ```

Obsidian debug info

Debug info ``` SYSTEM INFO: Obsidian version: v1.5.3 Installer version: v1.5.3 Operating system: Windows 10 Home 10.0.19045 Login status: not logged in Insider build toggle: off Live preview: on Base theme: adapt to system Community theme: Atom v0.0.0 Snippets enabled: 2 Restricted mode: off Plugins installed: 1 Plugins enabled: 1 1: Self-hosted LiveSync v0.22.4 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. ```

Plug-in log

These are the logs of "one full cycle". Meaning I reloaded Obsidian, then I waited for the message on the second device, reloaded the second device (at 07:44:05) and then the message appeared on the first device again.

Plug-in log ``` 1.2.2024, 07:43:48->Cache initialized 300 / 250000000000 1.2.2024, 07:43:48->loading plugin 1.2.2024, 07:43:48->Self-hosted LiveSync v0.22.4 0.22.4 1.2.2024, 07:43:48->All files enumerated 1.2.2024, 07:43:48->Waiting for ready... 1.2.2024, 07:43:48->Cache initialized 10 / 1000000000 1.2.2024, 07:43:48->Cache initialized 300 / 50000000 1.2.2024, 07:43:48->Newer xxhash has been initialised 1.2.2024, 07:43:48->Opening Database... 1.2.2024, 07:43:48->Database info 1.2.2024, 07:43:48->Log window opened 1.2.2024, 07:43:48->{ "doc_count": 528, "update_seq": 1555, "db_name": "Vault-livesync-v2-indexeddb", "auto_compaction": false, "adapter": "indexeddb" } 1.2.2024, 07:43:48->Database is now ready. 1.2.2024, 07:43:48->Initialize and checking database files 1.2.2024, 07:43:48->Checking deleted files 1.2.2024, 07:43:48->Collecting local files on the storage 1.2.2024, 07:43:48->Collecting local files on the DB 1.2.2024, 07:43:48->Opening the key-value database 1.2.2024, 07:43:48->Updating database by new files 1.2.2024, 07:43:48->UPDATE DATABASE: Nothing to do 1.2.2024, 07:43:48->UPDATE STORAGE 1.2.2024, 07:43:48->Deletion history skipped: Welcome.md 1.2.2024, 07:43:48->Deletion history skipped: Files/dharma.png 1.2.2024, 07:43:48->Deletion history skipped: 0 Zettelkasten/Meaning of Life.md 1.2.2024, 07:43:48->Deletion history skipped: 1 References/How to Win Friends and Influence People.md 1.2.2024, 07:43:48->Deletion history skipped: 0 Zettelkasten/yo.md 1.2.2024, 07:43:48->Deletion history skipped: 0 Zettelkasten/Untitled.md 1.2.2024, 07:43:48->Deletion history skipped: Files/test.md 1.2.2024, 07:43:48->Deletion history skipped: 0 Zettelkasten/test.md 1.2.2024, 07:43:48->Deletion history skipped: 0 Zettelkasten/People.md 1.2.2024, 07:43:48->Deletion history skipped: 0 Zettelkasten/Yesterday.md 1.2.2024, 07:43:48->UPDATE STORAGE: DONE:10, FAILED:0, LAST:0 1.2.2024, 07:43:48->Deletion history skipped: 0 Zettelkasten/what the hell.md 1.2.2024, 07:43:48->Deletion history skipped: 0 Zettelkasten/what is this.md 1.2.2024, 07:43:48->Deletion history skipped: 1 Reference Notes/How to Win Friends and Influence People.md 1.2.2024, 07:43:48->Deletion history skipped: Templates/Zettle 1.md 1.2.2024, 07:43:48->UPDATE STORAGE All done: DONE:14, FAILED:0 1.2.2024, 07:43:48->Initialized, NOW TRACKING! 1.2.2024, 07:43:48->Synchronizing hidden files... 1.2.2024, 07:43:48->STORAGE == DB :Templates/MOC.md 1.2.2024, 07:43:48->STORAGE == DB :Templates/Book.md 1.2.2024, 07:43:48->STORAGE == DB :Templates/Zettle.md 1.2.2024, 07:43:48->STORAGE == DB :References/How to Win Friends and Influence People.md 1.2.2024, 07:43:48->STORAGE == DB :0 Zettelkasten/Manners.md 1.2.2024, 07:43:48->STORAGE == DB :0 Zettelkasten/Dukkha.md 1.2.2024, 07:43:48->STORAGE == DB :0 Zettelkasten/How to Make People do Something.md 1.2.2024, 07:43:48->STORAGE == DB :0 Zettelkasten/Dharma.md 1.2.2024, 07:43:48->STORAGE == DB :0 Zettelkasten/Being a Man.md 1.2.2024, 07:43:48->STORAGE == DB :0 Zettelkasten/Animals vs Humans.md 1.2.2024, 07:43:48->Scanning hidden files. 1.2.2024, 07:43:48->Hidden files scanned: 0 files had been modified 1.2.2024, 07:43:48->Synchronizing hidden files done 1.2.2024, 07:43:48->Cache initialized 300 / 50000000 1.2.2024, 07:43:48->Scanning hidden files. 1.2.2024, 07:43:49->Hidden files scanned: 0 files had been modified 1.2.2024, 07:43:49->Modifying callback of the save command 1.2.2024, 07:43:49->Additional safety scan.. 1.2.2024, 07:43:49->Before LiveSync, start OneShot once... 1.2.2024, 07:43:49->OneShot Sync begin... (pullOnly) 1.2.2024, 07:43:49->There are no conflicted files 1.2.2024, 07:43:49->Additional safety scan done 1.2.2024, 07:43:49->Replication paused 1.2.2024, 07:43:49->Replication completed 1.2.2024, 07:43:49->LiveSync begin... 1.2.2024, 07:43:49->Content saved:.obsidian/core-plugins.json ,chunks: 1 (new:0, skip:2, cache:1) 1.2.2024, 07:43:49->STORAGE --> DB:.obsidian/core-plugins.json: (hidden) Done 1.2.2024, 07:43:49->Content saved:.obsidian/core-plugins-migration.json ,chunks: 1 (new:0, skip:2, cache:1) 1.2.2024, 07:43:49->Replication activated 1.2.2024, 07:43:49->STORAGE --> DB:.obsidian/core-plugins-migration.json: (hidden) Done 1.2.2024, 07:43:49->Content saved:.obsidian/app.json ,chunks: 1 (new:0, skip:2, cache:1) 1.2.2024, 07:43:49->Replication paused 1.2.2024, 07:43:49->STORAGE --> DB:.obsidian/app.json: (hidden) Done 1.2.2024, 07:43:49->Content saved:.obsidian/appearance.json ,chunks: 1 (new:0, skip:2, cache:1) 1.2.2024, 07:43:49->Replication activated 1.2.2024, 07:43:49->STORAGE --> DB:.obsidian/appearance.json: (hidden) Done 1.2.2024, 07:43:49->Content saved:.obsidian/community-plugins.json ,chunks: 1 (new:0, skip:2, cache:1) 1.2.2024, 07:43:49->STORAGE --> DB:.obsidian/community-plugins.json: (hidden) Done 1.2.2024, 07:43:50->Replication paused 1.2.2024, 07:44:05->Replication activated 1.2.2024, 07:44:05->START :Applying hidden 1 files change 1.2.2024, 07:44:06->Scanning hidden files. 1.2.2024, 07:44:06->Hidden files scanned: 1 files had been modified 1.2.2024, 07:44:06->DONE :Applying hidden 1 files change 1.2.2024, 07:44:06->START :Applying hidden 3 files change 1.2.2024, 07:44:06->Replication paused 1.2.2024, 07:44:06->Scanning hidden files. 1.2.2024, 07:44:06->Hidden files scanned: 3 files had been modified 1.2.2024, 07:44:06->DONE :Applying hidden 3 files change 1.2.2024, 07:44:06->START :Applying hidden 1 files change 1.2.2024, 07:44:06->Scanning hidden files. 1.2.2024, 07:44:06->Hidden files scanned: 1 files had been modified 1.2.2024, 07:44:06->DONE :Applying hidden 1 files change ```

Other information, insights and intuition.

I am using a selfhosted CouchDB.

calvinbui commented 4 months ago

Same happens for me. It's always the same plugins as well such as iconize, custom sort and periodic notes.

Then there's always this conflict with no changes.

Screenshot_20240209_012419_Obsidian

wayofsamu commented 4 months ago

Same here. For me it would be ok, if I could only pull changes from the remote database to my phone. But when I choose "Fetch" the hidden files from my phone are also pushed to remote. Which cause problems.

ttttonyhe commented 4 months ago

Same here. Fetch method is not working as intended.

vrtmrz commented 4 months ago

Thank you for reporting the issue! The hidden files and customisation synchronisation did not check if the file was actually modified when the modification event occurred. And, unfortunately, I forgot that the modification event will be raised when Obsidian starts up.

At v0.22.10, every change is compared to the database once and only actually changed things will be saved. This resolves this issue. Would you mind if I ask you to check the behaviour, please?

calvinbui commented 4 months ago

so far it hasn't prompted me