Skip to content

Fix: prevent infinite sync loop by ignoring 'updated' timestamp in equality check#25

Open
carlos-otero wants to merge 1 commit intoHeiss:mainfrom
carlos-otero:fix/infinite-sync-loop
Open

Fix: prevent infinite sync loop by ignoring 'updated' timestamp in equality check#25
carlos-otero wants to merge 1 commit intoHeiss:mainfrom
carlos-otero:fix/infinite-sync-loop

Conversation

@carlos-otero
Copy link
Copy Markdown

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 compareModelTasks function in src/processing/processor.ts included the updated timestamp 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 updated field from the compareModelTasks return 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.

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

Successfully merging this pull request may close these issues.

1 participant