Skip to content

refactor: inline onEvent into MergeHub.tryProcessNext#2901

Open
He-Pin wants to merge 1 commit intoapache:mainfrom
He-Pin:refactor-mergehub-inline-onevent
Open

refactor: inline onEvent into MergeHub.tryProcessNext#2901
He-Pin wants to merge 1 commit intoapache:mainfrom
He-Pin:refactor-mergehub-inline-onevent

Conversation

@He-Pin
Copy link
Copy Markdown
Member

@He-Pin He-Pin commented Apr 24, 2026

Summary

  • Inline the Boolean-returning onEvent helper directly into MergedSourceLogic.tryProcessNext
  • Pattern-match the event in place: Element pushes and exits, Register/Deregister continue the @tailrec loop to drain control messages from the queue
  • Same wakeup protocol, same demand handling — purely a clarity refactor

Motivation

onEvent returned a Boolean flag whose only purpose was to tell tryProcessNext whether to continue looping. Folding the dispatch into the call site removes the indirection and makes the loop / exit conditions read in one place.

Test plan

  • sbt scalafmtAll
  • sbt stream/compile@tailrec accepted, no warnings
  • sbt "stream-tests/testOnly org.apache.pekko.stream.scaladsl.HubSpec" — 48/48 in 18s

Drop the Boolean-returning onEvent helper; pattern-match the event
directly inside tryProcessNext. Element pushes and exits, Register and
Deregister recurse via @tailrec to drain control messages from the
queue. Same protocol, no behavior change.
@He-Pin He-Pin requested a review from pjfanning April 24, 2026 11:50
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