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
For example, netbox future:wait_result() fails on a negative timeout with an exception instead of just returning nil,err. That is quite unhandy. Consider this example (from vshard):
foruuid, futureinpairs(futures) dores, err=future:wait_result(timeout)
-- Handle netbox error first.ifres==nilthenerr_uuid=uuidgotofailend-- Ref returns nil,err or bucket count.res, err=res[1], res[2]
ifres==nilthenerr_uuid=uuidgotofailendbucket_count=bucket_count+restimeout=deadline-fiber_clock()
end
Here I don't want to care whether timeout is 0 or -0.000001 (in this case I just missed it). I don't want to check it explicitly. Code is 5 lines shorter in this case when I can trust :wait_result() to gracefully return an error on a negative timeout. Otherwise I would need to add:
(I will need to add it now anyway, because I have to support old versions too.)
The problem grows when I have many :wait_result() usages and have to invent one another vshard.util function to make it easier to use.
AFAIR the same problem is at least with our condition variables.
It might even be called inconsistent, because we legally allow to have negative timeouts - clock_* functions in clock.lua return int64_t specifically not to care about accidentally going below zero.
The text was updated successfully, but these errors were encountered:
For example, netbox
future:wait_result()
fails on a negative timeout with an exception instead of just returningnil,err
. That is quite unhandy. Consider this example (from vshard):Here I don't want to care whether timeout is 0 or -0.000001 (in this case I just missed it). I don't want to check it explicitly. Code is 5 lines shorter in this case when I can trust
:wait_result()
to gracefully return an error on a negative timeout. Otherwise I would need to add:(I will need to add it now anyway, because I have to support old versions too.)
The problem grows when I have many
:wait_result()
usages and have to invent one anothervshard.util
function to make it easier to use.AFAIR the same problem is at least with our condition variables.
It might even be called inconsistent, because we legally allow to have negative timeouts -
clock_*
functions inclock.lua
returnint64_t
specifically not to care about accidentally going below zero.The text was updated successfully, but these errors were encountered: