Skip to content

Polling drops >100 changes per interval (single-chunk force-advance) #61

Description

@jack-arturo

Summary

checkForPollingChanges (src/polling.ts) reads a single 100-entry sync chunk and then force-advances its cursor to the current updateCount:

const chunk = await evernoteApi.getFilteredSyncChunk(lastUpdateCount, maxEntries /* 100 */, buildSyncChunkFilter());
return { changes: changesFromSyncChunk(chunk, now), currentUpdateCount, nextUpdateCount: currentUpdateCount };

If more than maxEntries (100) changes occurred since the last poll, every change past the first 100 in that USN range is silently dropped — the cursor jumps to currentUpdateCount without those entries ever being surfaced as webhook notifications.

Impact

  • Webhook consumers miss change notifications during bursts of >100 edits between polls (e.g. a bulk import/edit, or a long poll interval).
  • Tolerable-ish for best-effort webhooks, but it's a real correctness gap.

Context

The USN-keyed note body cache added in #60 (src/note-cache.ts) deliberately does not reuse this path for exactly this reason — it runs its own looped getFilteredSyncChunk walk that paginates on chunkHighUSN until it reaches updateCount, so it never truncates. That loop is the reference implementation for fixing polling here.

Proposed fix

Loop getFilteredSyncChunk in checkForPollingChanges (paginate on chunkHighUSN until >= currentUpdateCount, with a sane iteration cap) instead of reading one chunk and force-advancing. Reuse the pagination shape from NoteCache in src/note-cache.ts. Extend __tests__/unit/polling.test.ts with a multi-chunk (>100 change) case.

Filed as a follow-up from #60.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions