Skip to content

tg db migrate without the daemon: give other tg commands a turn #122

Closed

Description

@neoromantic

Since #121, tg db migrate pauses 150 ms after each batch of about 50 ms while the daemon runs, so a daemon write never waits longer than a batch. Without the daemon it runs batches back to back, as fast as it can. Another tg command that writes the same cache at that time (tg messages list caching a page, tg send caching the sent message) can still wait for the whole migration and fail with database is locked after its 5 s busy_timeout: on a 10M-message cache the migration takes minutes (docs/storage.md).

Proposed: without the daemon, pause once per second of work (about 15% more time), so any writer gets the lock within about a second. Measure the cost with bun run bench:storage --old-form.

Done when a test with a writer in another process and no daemon shows no refusal during a migration longer than its busy_timeout, and the docs give the cost. Related: #89, #121.

Activity

  1. added
    enhancement
    on Oct 29, 2026
  2. added 2 commits that reference this issue on Nov 17, 2026
    24cf852
    8b1903f
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions