Unregister `after` timeouts
Opened this issue · 0 comments
NicolasT commented
With #36, registerDelay
is used for every receive
clause with an after
match. This registers a timeout in the RTS. Now, when the timeout is not reached (i.e., a matching message is received before the after
clause fires), this leaks such timeout.
This could be an issue in practice, especially when "long" timeouts are used.
There's no way to unregister timeouts when using the registerDelay
API (since it doesn't return any TimeoutKey
), but it's likely possible to implement this, basically duplicating the implementation of registerDelay
from base
, now returning the TimeoutKey
which can then be unregisterTimeout
'ed once dequeue
returned (ideally using some finally
construct, of course).