Skip to content

docs: notes from a long-running client - #271

Open
ernado wants to merge 2 commits into
mainfrom
docs/tglog-notes
Open

ernado wants to merge 2 commits into
mainfrom
docs/tglog-notes

Conversation

@ernado

@ernado ernado commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Notes from running gotd in a long-running, multi-account archiver. Each one explains behaviour that already exists.

Update recovery (helpers/updates-recovery.md):

  • Your own sends. The results of sendMessage, editMessage and similar calls reach only the calling session. Without UpdateHook your handler sees them late. Even with it, updateShortSentMessage becomes MessageEmpty. The page includes a middleware that rebuilds the message from the request.
  • "Failed to load channel state". Explains what the warning means (a stored pts with no access hash) and how to fix it (the hasher, or TrackChannel).
  • Channels that aren't pushed. They're polled every 15 minutes (channel-idle-timeout), so they arrive up to 15 minutes late. Covers how the official clients handle this and how to spot it in the metrics.

Long-running clients (advanced/long-running.md), lost authorization in practice:

  • a terminated session shows up as AUTH_KEY_UNREGISTERED;
  • the loss is detected on the next request that needs authorization;
  • with a shared errgroup, one account's AuthLostError stops every account;
  • how to test it safely on a spare account.

Observability (advanced/observability.md):

  • several clients on one MeterProvider, separated with a scope attribute per client (otlp.promote_scope_metadata for Prometheus);
  • why the state counter can't tell you whether a client is connected right now.

Facts checked against td main: the 15-minute idle timer, which resets on each channel update; loadChannels; convertShortSentMessage; the UpdateShortSentMessage fields; MiddlewareFunc. yarn build passes.

Banned, deleted and frozen accounts

Documents gotd/td#1934 (AuthLostKindOf, AUTH_KEY_DROP_*, OnFrozen, FreezeState, gotd.client.account.restricted). Merge after #1934 is merged.

…lti-client metrics

From running gotd in a long-running archiver (tglog): what surprised and how to handle it.
Document AuthLostKindOf, AUTH_KEY_DROP_* notifications, OnFrozen and FreezeState,
and the new metric attribute, counter and log events (gotd/td#1934).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant