Skip to content

Background sync interval not awaited - overlapping syncs possible #255

@Retengart

Description

@Retengart

Problem

setInterval callback doesn't await handleSyncIndex().

Current Behavior

// sync.ts:136-139
const syncInterval = setInterval(() => {
    console.log('[SYNC-DEBUG] Executing scheduled periodic sync');
    this.handleSyncIndex(); // Not awaited!
}, 5 * 60 * 1000);

Impact

If sync takes >5 minutes, next interval fires while previous still running. The isSyncing flag helps but doesn't prevent queueing.

Expected Behavior

Either:

  1. Await completion before scheduling next
  2. Use setTimeout recursively instead of setInterval
  3. Skip interval if previous sync still running

Location

  • packages/mcp/src/sync.ts:136-139

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions