pjfanning commented on code in PR #1366:
URL: https://github.com/apache/pekko/pull/1366#discussion_r1641133602
##########
actor/src/main/scala/org/apache/pekko/actor/LightArrayRevolverScheduler.scala:
##########
@@ -54,18 +54,35 @@ class LightArrayRevolverScheduler(config: Config, log:
LoggingAdapter, threadFac
import Helpers.ConfigOps
import Helpers.Requiring
- val WheelSize =
+ val WheelSize: Int =
config
.getInt("pekko.scheduler.ticks-per-wheel")
.requiring(ticks => (ticks & (ticks - 1)) == 0, "ticks-per-wheel must be
a power of 2")
- val TickDuration =
- config
- .getMillisDuration("pekko.scheduler.tick-duration")
- .requiring(
- _ >= 10.millis || !Helpers.isWindows,
- "minimum supported pekko.scheduler.tick-duration on Windows is 10ms")
- .requiring(_ >= 1.millis, "minimum supported
pekko.scheduler.tick-duration is 1ms")
- val ShutdownTimeout =
config.getMillisDuration("pekko.scheduler.shutdown-timeout")
+
+ val TickDuration: FiniteDuration = {
+ val durationFromConfig =
config.getMillisDuration("pekko.scheduler.tick-duration")
+ val errorOnVerificationFailed =
config.getBoolean("pekko.scheduler.error-on-tick-duration-verification-failed")
+
+ if (Helpers.isWindows && durationFromConfig < 10.millis) {
+ if (errorOnVerificationFailed) {
+ throw new IllegalArgumentException(
+ "requirement failed: minimum supported pekko.scheduler.tick-duration
on Windows is 10ms")
+ } else {
+ log.warning(
+ "requirement failed: minimum supported pekko.scheduler.tick-duration
on Windows is 10ms, adjusted to 10ms now.")
+ 10.millis
+ }
+ } else if (durationFromConfig < 1.millis) {
Review Comment:
Can you move this inside the other other check to improve performance -
avoiding 2 checks in happy path?
appproximately
```
if <10ms {
if (isWindows) {
... windows warning or throw
} else if < 1ms {
... 1ms warning or throw
} else durationFromConfig
}
```
--
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]