Skip to content

Daemon loses messages that arrive while it is stopped #15

Closed

Description

@neoromantic

If a chat gets new messages while the daemon is stopped, the first live message after a restart makes them a permanent gap in the cache.

Why:

  • The live handler moves the chat's forward cursor to the newest message ID (updateForwardCursor in src/daemon/handlers.ts).
  • Live updates start before the job scheduler (connectAccount in src/daemon/daemon-accounts.ts), so a live message usually lands before the catch-up job runs.
  • A forward catch-up fetches only the newest 100 messages above the cursor and then moves the cursor to the top (src/daemon/sync-worker-real-jobs.ts).
  • mtcute's catchUp option is not enabled, so missed updates aren't replayed on start.

Example: a chat gets 150 messages while the daemon is off. After the restart, one new message arrives, and those 150 are never fetched.

Fix: keep the live cursor separate from the catch-up cursor (or catch up before starting updates), page the catch-up until it reaches the cursor, and consider updates: { catchUp: true }.

Done when a test with a 150-message gap shows every message cached after a restart.

Activity

  1. added
    bug
    on Oct 21, 2026
  2. added 2 commits that reference this issue on Oct 21, 2026
    e0dbb3e
    6360d82
  3. added a commit that references this issue on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions