Fix CONFIG opcode timeouts on startup (op=22) - #6
Draft
erop39 wants to merge 1 commit into
Draft
Conversation
Opcode 22 (CONFIG) is write-only in the Max protocol — it sets mute settings but does not return them. The previous fetch_settings() RPC blocked startup with 8s timeouts per attempt. Load mute state from AUTH_SNAPSHOT (chats + settings.chats) instead, request a fuller snapshot (chatsCount 40 + sync params), and apply live updates from NOTIF_CHAT / NOTIF_CONFIG payloads. Co-authored-by: eGoR <erop39@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After login, the service logged repeated warnings:
This blocked startup for ~16–32 seconds before participant resolution, even though mute state was already loaded from the snapshot (7 muted chats).
Root cause
Opcode 22 (CONFIG) in the Max WebSocket protocol is write-only — it is used to set mute/unmute (
dontDisturbUntil), not to fetch settings. The previousfetch_settings()implementation sent CONFIG RPC requests and waited for responses that never arrive.Fix
NOTIF_CONFIGAUTH_SNAPSHOT(chats[]+settings.chats+config)chatsCount: 40, sync params)NOTIF_CHAT/NOTIF_CONFIGpush payloadsSKIP_MUTED=trueTesting
pytest -q— 230 tests pass