Skip to content

handlematrix: don't block on RTM queue when sending typing - #128

Merged
Fizzadar merged 1 commit into
mainfrom
indent/typing-nonblocking
Oct 27, 2026
Merged

Fizzadar merged 1 commit into
mainfrom
indent/typing-nonblocking

Conversation

@Fizzadar

@Fizzadar Fizzadar commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

HandleMatrixTyping called RTM.SendMessage, which blocks once slackgo's 20-slot outgoing queue is full. That queue is only drained while the RTM websocket is connected, so it fills up whenever RTM is down: during reconnects, or for good when Connect fails at client.userBoot and ManageConnection never starts.

Once that happens, the typing handler goroutine never returns. bridgev2 calls it with the portal's currentlyTypingLock held, so every later typing event in that room waits on the lock until the portal event loop gives up after 5 minutes (EventHandlingTimeoutTicks × 30s) and backgrounds it. Each typing event in that chat stalls the portal's event loop for 5 minutes.

Changes:

  • Send with the new non-blocking RTM.TrySendMessage (websocket: add non-blocking RTM.TrySendMessage beeper/slackgo#8) and return an error when the queue is full, so bridgev2 logs a failed typing send instead of hanging.
  • Return early when IsTyping is false. Slack's RTM has no stop-typing message, and we were sending a typing notification for stop events too.
  • Return ErrNotLoggedIn if RTM has been cleared by disconnect(), instead of dereferencing nil.

go.mod bumps slackgo from b34085b to 2c1b2ed, the merged beeper/slackgo#8 and its only new commit.

Checked: go build ./..., go vet ./pkg/connector, staticcheck ./pkg/connector.

View in Indent
Tag @indent to continue the conversation here.

@Fizzadar
Fizzadar marked this pull request as ready for review October 27, 2026 11:36
@indent

indent Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Issues

No issues found.

CI Checks

All required CI checks passed on db9aec9.

Review agents

Select any unchecked box below to run or rerun that agent.

Passed (1)
  • Indent Review Agent · No bugs found in the non-blocking typing change.
Full results

Indent Review Agent

  • Summary: No bugs found in the non-blocking typing change.
  • Last ran on commit: db9aec91
  • Latest result
    {
      "summary": "No bugs found in the non-blocking typing change.",
      "findings": []
    }

Comment thread go.mod Resolved
@indent
indent Bot force-pushed the indent/typing-nonblocking branch from 70b9025 to db9aec9 Compare October 27, 2026 12:12
@Fizzadar
Fizzadar merged commit 6b31f7b into main Oct 27, 2026
12 checks passed
@Fizzadar
Fizzadar deleted the indent/typing-nonblocking branch October 27, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants