He-Pin opened a new pull request, #3108: URL: https://github.com/apache/pekko/pull/3108
### Motivation The `Throttle` stage's `costCalculation` function had no exception handling. If the user-provided cost function threw, the exception propagated directly and failed the stage unconditionally. Unlike other stages (`MapAsync`, `Filter`, `Log`), `Throttle` did not consult the `SupervisionStrategy` decider, preventing users from configuring Resume or Restart behavior for bad elements. Fixes #3101 ### Modification - Add `try-catch` around `costCalculation(elem)` with `NonFatal` handling - Add `decider` lookup via `SupervisionStrategy` mandatory attribute - On `Stop`: `failStage` (preserves default behavior) - On `Resume`/`Restart`: log at debug level and `pull` next element - Mix in `StageLogging` for observability - Add 4 new tests covering Resume, Restart, Stop directives and Enforcing mode ### Result Users can now configure supervision strategy on `Throttle` to skip elements that cause `costCalculation` exceptions, matching the behavior of other stages in Pekko Streams. ### Tests ``` sbt "stream-tests / Test / testOnly org.apache.pekko.stream.scaladsl.FlowThrottleSpec" # 27 tests passed (4 new + 23 existing) ``` ### References Fixes #3101 Inspired by [akka.net#6886](https://github.com/akkadotnet/akka.net/pull/6886) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
