You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #847 the api of request_timer was changed to work with Duration instead of Instant.
This was done quickly in order to make the CI work again, by changing request_timer to
So Duration seems to be the way to go for immediate API calls. One scenario where Instant could be useful is for non-druid druid-shell users who want to request a timer but the request will sit in some queue first and so the timer would be out of sync with Duration but with Instant it would subtract the amount of time it sat in that queue. Not sure this is a feature that druid-shell needs to offer though, because the program that has such a queue could just translate its own Instant to Duration the moment it will invoke druid-shell's timer request method.
Are there any other reasons why Instant makes sense over Duration?
The exact rationale was something like that; that you might compute when you wanted the timer to fire, but have it sit around for a while. I think I went back and forth over which made the most sense, and ultimately just went with Instant; it feels more 'precise' in a mostly theoretical way. I don't mind if this changes.
There are some precision gains by using Instant in a different situation but I think all of that is lost in this specific case by the lack of guarantees that the timer itself has. The timer isn't guaranteed to be accurate at all and can differ from the desired duration/instant by 10ms.
That combined with now having seen a bunch of actual usage where it would be more ergonomical to just use a Duration, I think it might be better to switch to that even for druid-shell.
In #847 the api of
request_timer
was changed to work withDuration
instead ofInstant
.This was done quickly in order to make the CI work again, by changing
request_timer
toWhich means the back ends were not affected by this.
As @xStrom mentioned on Zulip:
So it would make sens to handle the
Duration
properly in each backend.The text was updated successfully, but these errors were encountered: