Skip to content

Improve Decode with switch to using local buffers#683

Merged
hloeung merged 2 commits into
42wim:masterfrom
hloeung:decode-buffering
Jul 11, 2026
Merged

Improve Decode with switch to using local buffers#683
hloeung merged 2 commits into
42wim:masterfrom
hloeung:decode-buffering

Conversation

@hloeung

@hloeung hloeung commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Split these changes out from #677

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors User.Decode() to avoid using u.BufferedMsg shared state by switching to a goroutine-local buffer and a buffered channel, and it changes ghost-user behavior to skip Decode() rather than blocking forever.

Changes:

  • Replace the global u.BufferedMsg accumulation with a local bufferedMsg inside the decode buffer goroutine.
  • Use a buffered buffer channel (size 512) and consolidate flush logic into a helper.
  • For ghost users, return early from Decode() with a debug log instead of blocking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mm-go-irckit/user.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@hloeung hloeung merged commit efefe93 into 42wim:master Jul 11, 2026
4 checks passed
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.

2 participants