He-Pin opened a new pull request, #3393:
URL: https://github.com/apache/pekko/pull/3393

   ### Motivation
   
   `AdjustPoolSize` bypasses pool configuration bounds (#3253). When a resizer 
is configured, the pool can grow beyond `upperBound` or shrink below 
`lowerBound`. Without a resizer, the pool can shrink to zero routees, causing 
message loss.
   
   ### Modification
   
   - Add a `clamp(proposedSize: Int): Int` method to the `Resizer` trait 
(default: min 1). This is binary compatible — concrete trait methods compile to 
Java default methods.
   - Override `clamp` in `DefaultResizer` and 
`DefaultOptimalSizeExploringResizer` to enforce their `lowerBound`/`upperBound`.
   - `ResizablePoolActor` now intercepts `AdjustPoolSize` and clamps the 
resulting pool size via the resizer's `clamp` method, before it reaches the 
unbounded parent handler.
   - `RouterPoolActor` enforces a minimum of 1 routee for non-resizer pools.
   - Update `AdjustPoolSize` Scaladoc to reflect the new bounded behavior.
   
   ### Result
   
   `AdjustPoolSize` respects resizer bounds when a resizer is configured, and 
never shrinks a pool below 1 routee otherwise. Growth without a resizer remains 
unbounded (existing behavior preserved).
   
   ### Tests
   
   - `sbt "actor-tests / Test / testOnly 
org.apache.pekko.routing.RoundRobinSpec"` — passed (7 tests)
   - `sbt "actor-tests / Test / testOnly org.apache.pekko.routing.ResizerSpec"` 
— passed (13 tests)
   - `sbt "actor / mimaReportBinaryIssues"` — passed
   - `scalafmt --mode diff-ref=origin/main` — passed
   - `sbt headerCreateAll` — passed
   
   ### References
   
   Fixes #3253


-- 
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]

Reply via email to