Skip to content

Retry failed sync jobs with backoff #9

Closed

Description

@neoromantic

A sync job that fails is not retried. Add a retry policy for sync jobs: exponential backoff, a maximum number of attempts, and a visible failed state in tg status.

Activity

  1. neoromantic commented on Oct 21, 2026

    @neoromantic
    OwnerAuthor

    Checked against the code on 2026-10-21:

    • Job states are pending, running, completed and failed, with no attempt counter and no next-run time (src/db/sync-schema.ts).
    • Every error marks the job failed, including rate limits (src/daemon/sync-worker-utils.ts), and the daemon only logs it.
    • There is a hidden retry anyway: refreshQueues queues a new job for the chat on the next refresh, with no backoff and no limit. Permanent errors (for example "Could not build InputPeer") retry forever, and each try leaves a failed row that is never cleaned up (cleanupFailed has no callers).
    • tg status always shows failed_jobs: 0: the value is hard-coded in src/commands/status.ts.

    Add to the scope: treat a FLOOD_WAIT as a delay rather than a failure, tell permanent errors from transient ones, and make tg status count failed jobs.

  2. added
    bug
    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