feat: add timeout duration to ReceiveTimeout message - #3399
Draft
He-Pin wants to merge 2 commits into
Draft
Conversation
Motivation: ReceiveTimeout was a case object singleton carrying no information about the configured timeout duration, making it impossible to log or inspect the timeout value from the message handler without accessing context.receiveTimeout separately (#2569). Modification: Convert ReceiveTimeout from a case object to a final case class with a `timeout: FiniteDuration` field. The scheduler now sends ReceiveTimeout(duration) instead of the singleton. All pattern matches updated from stable identifier patterns to type patterns. Java API updated from matchEquals(getInstance()) to match(ReceiveTimeout.class). Result: Users can now access the timeout duration directly from the message: case timeout: ReceiveTimeout => log.info("timeout: {}", timeout.timeout)
He-Pin
marked this pull request as draft
July 29, 2026 18:28
Apply code formatting and update MiMa exclusion filters to match the exact binary compatibility problems reported by CI.
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.
Summary
ReceiveTimeoutfrom acase objectsingleton to afinal case class ReceiveTimeout(timeout: FiniteDuration)so the message carries the configured timeout durationcase timeout: ReceiveTimeout => log.info("timeout: {}", timeout.timeout)Motivation
Previously
ReceiveTimeoutwas a case object with no information, making it impossible to log or inspect the timeout value without separately accessingcontext.receiveTimeout. As noted in the issue, this made logging awkward:Changes
actor/src/main/scala/.../Actor.scala: ConvertReceiveTimeoutfromcase objecttofinal case classwithtimeout: FiniteDurationfield and Java APIgetTimeoutmethodactor/src/main/scala/.../dungeon/ReceiveTimeout.scala: Scheduler now sendsReceiveTimeout(timeout)instead of the singletoncase ReceiveTimeout =>) to type patterns (case _: ReceiveTimeout =>)matchEquals(ReceiveTimeout.getInstance(), ...)tomatch(ReceiveTimeout.class, ...)Breaking changes (2.0)
ReceiveTimeoutis no longer a singleton; pattern matches must use type patternsReceiveTimeout.getInstance()removed; Java users should use.match(ReceiveTimeout.class, ...)Test plan
actor-tests/testOnly *.ReceiveTimeoutSpec— 15 tests pass (including new "carry the configured timeout duration" test)actor-typed-tests/testOnly *.CancelReceiveTimeoutSpec— passes