vert.x
vert.x copied to clipboard
setTimer should not throw when delay < 1
Version
4.1.2
Context
When setTimer is called with delay <1, it will throw IllegalArgumentException.
This behavior is unacceptable as it can easily take down the whole service.
Instead, it simply needs to do max(delay, 1).
Note that node.js doesn't throw in this case. There is no sane argument why it should throw. setTimer(0) simply means execute as soon as possible.
If you need to schedule a task for execution asap, you can use io.vertx.core.Vertx#runOnContext.
If you're willing to provide a PR we may consider it.