lynxaegon / obsidian-anysocket-sync

Securely Synchronize your Vault on a self-hosted server
MIT License
9 stars 0 forks source link

Wrong sync #12

Closed declider closed 2 weeks ago

declider commented 3 weeks ago

Hi! First of all, thanks for plugin! From all of them, it is best sync solution. But it works wrong for me :(

For some reason PC Obsidian always copy files and it's content from Android obsidian, ignoring when it was updated. Even if i didn't touch phone-Obsidian for few days and have lot of changes in vault on PC-Obsidian, after sync all my edits in files will be gone, phone-Obsidian will get no old file updates, and PC-Obsidian will downgrade those files to their few-days old versions phone have.

So it's impossible for me to sync it without data loss.

lynxaegon commented 3 weeks ago

Hi, this is quite interesting because it should never happen. But i do have a few questions:

The client works by capturing file updates (with server timestamp) and sending them to the server which decides which file is newer.

You can always enable debug on both server and client and look into the logs and see what happens.

I've been using this since i made it and i never had any data loss, but i'm always online while editing notes

declider commented 3 weeks ago

I am trying some different approaches like having server and connection on PC always on, or having it both disabled, but it change nothing and i always lose my PC data when mobile opens and connects to server.

lynxaegon commented 3 weeks ago

Could you check the version history for a file that was wrongly synced? I want to know if you do have the correct versions there.

Without seeing any logs, i can only presume that the mobile is doing something shady and updating the server with older versions.

declider commented 3 weeks ago

I tested it, with timestamps and screenshots: https://imgur.com/a/v2GWNuX 14:50 - have both devices connected, file looks same on both. 14:51 - closing mobile version, writing text in note 14:52 - still writing text in note, gonna enable mobile obsidian 14:53 - mobile obsidian enabled, my text is gone, note downgraded to 14:50 version 14:54 - checking "modified" on mobile - it says "14:50", so it is indeed older version (it still says same "14:50" as i writing this comment)

How do i provide logs? I just checked "debug" in plugin settings, for both desktop and mobile versions

lynxaegon commented 2 weeks ago

Thank you for the great info. It seems the problem is on the mobile client, from what i suspect obsidian triggers a file update before it's connected to the server. I need to check exactly what's happening. Could you tell me which version of obsidian are you using on android?

To check debug logs, on mobile it's more complicated, since you need to connect the chrome dev tools to export them, but on the desktop client you can press ctrl + shift + i which opens the chrome dev tools and logs from anysocket should be there

declider commented 2 weeks ago

Android Obsidian:

About this:

It seems the problem is on the mobile client, from what i suspect obsidian triggers a file update before it's connected to the server.

I don't know how valuable this info, but that file from my previous comment still have "Last update: 11/04/20 14:50", even if i open Obsidian (without anysync plugin yet) and open this note from it - last update time doesn't change after opening obsidian and open this file.

About logs: got it, will try to collect some and return with them.

lynxaegon commented 2 weeks ago

I have fixed the bug in the latest version, i'll push a new version in an hour. Edit: Version 1.3.3 has been released

declider commented 2 weeks ago

Yep, tried few times, always works pefrect. Thanks!