Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync only works in 1 direction #241

Open
kenjibailly opened this issue Jul 12, 2023 · 12 comments
Open

Sync only works in 1 direction #241

kenjibailly opened this issue Jul 12, 2023 · 12 comments

Comments

@kenjibailly
Copy link

When I edit a document on my phone, it changes on my PC.
However when I edit a document on my PC it doesn't change on my phone.

I'm not sure what's causing this. I have live sync enabled on both devices and have reset the database a few times, even after fetch on my phone it doesn't change the document.

@vrtmrz
Copy link
Owner

vrtmrz commented Jul 14, 2023

Thank you for opening the issue!

Would you mind if I ask you to check the log that is shown on your device, please?
If DB <- STORAGE would not be shown while modifying some files, please make sure Suspend file watching have been disabled just in case. It is on the Hatch pane in the setting dialogue.

And if suspend file watching has been disabled, I hope to let me see about your whole configuration.
A configuration report can be made by the Make report button on the Hatch pane.

@kenjibailly
Copy link
Author

I didn't fully understand which logs you want to see and what you meant with DB <- STORAGE.
I have suspended file watching on PC and made a report which you can find below. Is the report on mobile different, should I add that one as well?

Thank you for looking into it!

----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
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: 127.0.0.1
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
single_node: "true"
uuid: 𝑅𝐸𝐷𝐴𝐶𝑇𝐸𝐷
view_index_dir: ./data

---- Plug-in config ---
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: true
trashInsteadDelete: true
periodicReplication: false
periodicReplicationInterval: 60
syncOnFileOpen: false
encrypt: true
passphrase: 𝑅𝐸𝐷𝐴𝐶𝑇𝐸𝐷
usePathObfuscation: false
doNotDeleteFolder: false
resolveConflictsByNewerFile: true
batchSave: false
deviceAndVaultName: ""
usePluginSettings: false
showOwnPlugins: false
showStatusOnEditor: true
usePluginSync: false
autoSweepPlugins: false
autoSweepPluginsPeriodic: false
notifyPluginOrSettingUpdated: false
checkIntegrityOnSave: false
batch_size: 50
batches_limit: 40
useHistory: true
disableRequestURI: true
skipOlderFilesOnSync: true
checkConflictOnlyOnOpen: false
syncInternalFiles: true
syncInternalFilesBeforeReplication: false
syncInternalFilesIgnorePatterns: /node_modules/, /.git/, /obsidian-livesync/
syncInternalFilesInterval: 60
additionalSuffixOfDatabaseName: ""
ignoreVersionCheck: false
lastReadUpdates: 0
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

@thucngyyen
Copy link

I got the same problem after resetting db for a few times, then I try change "Batch size" and "Batch limit", somehow it works: https://github.com/vrtmrz/obsidian-livesync/blob/main/docs/troubleshooting.md

@kenjibailly
Copy link
Author

I got the same problem after resetting db for a few times, then I try change "Batch size" and "Batch limit", somehow it works: https://github.com/vrtmrz/obsidian-livesync/blob/main/docs/troubleshooting.md

I tried different numbers, but that didn't help unfortunately.

@vrtmrz
Copy link
Owner

vrtmrz commented Jul 24, 2023

Thank you for the detail! and sorry for being delay.
The configuration looks fine. How about the log? Are there any related things shown?
Could you please enable the Verbose Log and see the log? (While changing the file).

@kenjibailly
Copy link
Author

Thank you for the detail! and sorry for being delay. The configuration looks fine. How about the log? Are there any related things shown? Could you please enable the Verbose Log and see the log? (While changing the file).

I enabled Verbose Log, but I don't know where I can find the log. Where is it outputted?

@vrtmrz
Copy link
Owner

vrtmrz commented Jul 31, 2023

Sorry for being late! The logs would be shown if we opened the log pane, by clicking archive-box icon.
If it was not shown for some reason, please enable Write logs into the file. Then, logs will be written into the file on top of your vault.

@kenjibailly
Copy link
Author

kenjibailly commented Aug 1, 2023

Sorry for being late! The logs would be shown if we opened the log pane, by clicking archive-box icon. If it was not shown for some reason, please enable Write logs into the file. Then, logs will be written into the file on top of your vault.

I still can't find the log pane. What do you mean by archive-box icon, the hatch pane?
I tried to enable "Write logs into the file", but it doesn't write anything. I tried to add some extra text to the file to trigger it, but it doesn't trigger.
image

Could you be more specific as where I can find the logs?

EDIT: I found the logs:

8/1/2023, 4:45:06 PM->Replication paused
8/1/2023, 4:45:07 PM->Replication activated
8/1/2023, 4:45:07 PM->Content saved:.obsidian/workspace.json ,chunks: 1 (new:0, skip:2, cache:1)
8/1/2023, 4:45:07 PM->STORAGE --> DB:.obsidian/workspace.json: (hidden) Done
8/1/2023, 4:45:08 PM->Replication paused
8/1/2023, 4:45:09 PM->Replication activated
8/1/2023, 4:45:10 PM->Content saved:Obsidian Vault/Tarot/Tarot Kaarten Betekenis.md ,chunks: 101 (new:1, skip:200, cache:100)
8/1/2023, 4:45:10 PM->DB <- STORAGE (plain) Obsidian Vault/Tarot/Tarot Kaarten Betekenis.md
8/1/2023, 4:45:10 PM->Replication paused
8/1/2023, 4:45:10 PM->Content saved:.obsidian/workspace.json ,chunks: 1 (new:0, skip:2, cache:1)
8/1/2023, 4:45:10 PM->STORAGE --> DB:.obsidian/workspace.json: (hidden) Done
8/1/2023, 4:45:10 PM->Replication activated

@jawadalami
Copy link

Sorry for being late! The logs would be shown if we opened the log pane, by clicking archive-box icon. If it was not shown for some reason, please enable Write logs into the file. Then, logs will be written into the file on top of your vault.

I still can't find the log pane. What do you mean by archive-box icon, the hatch pane? I tried to enable "Write logs into the file", but it doesn't write anything. I tried to add some extra text to the file to trigger it, but it doesn't trigger. image

Could you be more specific as where I can find the logs?

EDIT: I found the logs:

8/1/2023, 4:45:06 PM->Replication paused 8/1/2023, 4:45:07 PM->Replication activated 8/1/2023, 4:45:07 PM->Content saved:.obsidian/workspace.json ,chunks: 1 (new:0, skip:2, cache:1) 8/1/2023, 4:45:07 PM->STORAGE --> DB:.obsidian/workspace.json: (hidden) Done 8/1/2023, 4:45:08 PM->Replication paused 8/1/2023, 4:45:09 PM->Replication activated 8/1/2023, 4:45:10 PM->Content saved:Obsidian Vault/Tarot/Tarot Kaarten Betekenis.md ,chunks: 101 (new:1, skip:200, cache:100) 8/1/2023, 4:45:10 PM->DB <- STORAGE (plain) Obsidian Vault/Tarot/Tarot Kaarten Betekenis.md 8/1/2023, 4:45:10 PM->Replication paused 8/1/2023, 4:45:10 PM->Content saved:.obsidian/workspace.json ,chunks: 1 (new:0, skip:2, cache:1) 8/1/2023, 4:45:10 PM->STORAGE --> DB:.obsidian/workspace.json: (hidden) Done 8/1/2023, 4:45:10 PM->Replication activated

The archive box that vrtmrz is referring to is on the left side panel. It is the last icon in the attached screenshot below.

image

@kenjibailly
Copy link
Author

Hey @kenjibailly, you might want to review your Sync Settings. Under the "Conflict resolution" section, you'll see an option titled "Always overwrite with a newer file". If this option is enabled, it's possible that a device with a different timezone is causing your edits to appear "outdated", thereby preventing the changes from being reflected across your other devices. You can solve this by either disabling this feature or ensuring that all your devices are configured with the same timezone/time settings.

@vrtmrz, considering the above, would it be possible to modify the time comparison mechanism for this feature to use Coordinated Universal Time (UTC) instead of localized times? This change could prevent issues that arise due to timezone differences, especially important for users who travel frequently and thus have devices with regularly changing timezones, where syncing timezones across devices is not an option.

The option is disabled on both devices.

@kenjibailly
Copy link
Author

Sorry for being late! The logs would be shown if we opened the log pane, by clicking archive-box icon. If it was not shown for some reason, please enable Write logs into the file. Then, logs will be written into the file on top of your vault.

I still can't find the log pane. What do you mean by archive-box icon, the hatch pane? I tried to enable "Write logs into the file", but it doesn't write anything. I tried to add some extra text to the file to trigger it, but it doesn't trigger. image
Could you be more specific as where I can find the logs?
EDIT: I found the logs:
8/1/2023, 4:45:06 PM->Replication paused 8/1/2023, 4:45:07 PM->Replication activated 8/1/2023, 4:45:07 PM->Content saved:.obsidian/workspace.json ,chunks: 1 (new:0, skip:2, cache:1) 8/1/2023, 4:45:07 PM->STORAGE --> DB:.obsidian/workspace.json: (hidden) Done 8/1/2023, 4:45:08 PM->Replication paused 8/1/2023, 4:45:09 PM->Replication activated 8/1/2023, 4:45:10 PM->Content saved:Obsidian Vault/Tarot/Tarot Kaarten Betekenis.md ,chunks: 101 (new:1, skip:200, cache:100) 8/1/2023, 4:45:10 PM->DB <- STORAGE (plain) Obsidian Vault/Tarot/Tarot Kaarten Betekenis.md 8/1/2023, 4:45:10 PM->Replication paused 8/1/2023, 4:45:10 PM->Content saved:.obsidian/workspace.json ,chunks: 1 (new:0, skip:2, cache:1) 8/1/2023, 4:45:10 PM->STORAGE --> DB:.obsidian/workspace.json: (hidden) Done 8/1/2023, 4:45:10 PM->Replication activated

The archive box that vrtmrz is referring to is on the left side panel. It is the last icon in the attached screenshot below.

image

Thanks, took me a while to find it. This might help others in the future!

@vrtmrz
Copy link
Owner

vrtmrz commented Aug 3, 2023

Apologies for the insufficient documentation! And thank you all for the support!

In usual cases, the modified time of a file should be handled at UTC. Just expressed in our locale.

However, I noticed that Obsidian on Windows has no timezone information. I am wondering when they lost... Modified times of files are also dependent on Obsidian. Fortunately, for now, it looks retrieved as surely UTC unix epoch milliseconds.
Updated Sorry! My environment had been dirty! Obsidian and LiveSync are sane.

As the only time epoch is converted to a date type again is when it is displayed, (I hope to believe) this should be possibly not so relevant to this problem.

According to the log, your file looks surely saved in the database.
Would you mind if I ask to check the next step?

  1. Write something and save it on the device (oneway source).
  2. Check the log and make sure that Content saved is shown.
  3. Perform a replication. (You can do this in the button, beside the document-box icon)
  4. Check the log and the new chunks are surely sent to the remote.
  5. Then, move to the next device (in which no document arrived) and perform a replication.
  6. Check the log and the new document has (not) arrived.

Processed from 1 to 4, the log should be as below:
image

And, from 6 to 7, the log on the second device should be as below:
image

Would you please try these steps and check where our results have begun to diverge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants