Skip to content

Run each account's sync jobs independently in the daemon #60

Closed

Description

@neoromantic

Since #17 each account has its own cache, scheduler and sync worker, but the daemon still runs one sync job at a time: the job loop takes turns between accounts and awaits each job before the next tick.

mtcute's flood waiter sleeps inside the call for up to 5 minutes. While one account's messages.getHistory sleeps through a FLOOD_WAIT, the loop is blocked, so every other account's jobs wait too, even though their own rate limits are fine. With three or more busy accounts each one also syncs more slowly than alone, because there is one job per tick overall.

Fix: run each account's job loop on its own (one in-flight job per account, the 3 s inter-job delay per account as today), so one account's FLOOD_WAIT or slow page never stalls the others. Keep the per-account lane cycle and the retry rules of #6 and #9.

Done when a test with two accounts shows account 2 finishing jobs while account 1's job sleeps in a FLOOD_WAIT, and docs/daemon.md and docs/sync-strategy.md describe the per-account loops.

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