Fix: prevent infinite sync loop by ignoring 'updated' timestamp in equality check#25
Open
carlos-otero wants to merge 1 commit intoHeiss:mainfrom
Open
Fix: prevent infinite sync loop by ignoring 'updated' timestamp in equality check#25carlos-otero wants to merge 1 commit intoHeiss:mainfrom
carlos-otero wants to merge 1 commit intoHeiss:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes a critical issue where tasks would enter an infinite synchronization loop, updating continuously between Obsidian and Vikunja, and sometimes deleting dates and text.
The Issue
The
compareModelTasksfunction insrc/processing/processor.tsincluded theupdatedtimestamp in its equality check (local.updated === vikunja.updated).Because the timestamp changes every time a task is updated on either platform (and often differs by milliseconds or due to network latency), the plugin incorrectly identified identical tasks as "changed". This forced an unnecessary
update to the other platform, which in turn updated the timestamp again, triggering another sync in the next cycle.
The Fix
I removed the
updatedfield from thecompareModelTasksreturn statement.Two tasks are now considered equal if their content and status (title, description, due date, labels, priority, done status) are the same, regardless of when they were last touched. This prevents the loop while preserving
legitimate content updates.
Verification
Verified that the continuous update loop stops and tasks only sync when actual content is modified.