-
Task
-
Resolution: Done
-
Major
-
None
-
None
Today in the new client when an operation is to be submitted to the channel. We first generate an id and then from that register the operation to a HashMap and then register a timeout runnable with the netty scheduler which then is also fed into a different HashMap.
We should be able to instead utilize a RingBuffer and store both the operation and timeout information there. Note that we would only submit one netty timeout event as the RingBuffer guarantees order for us, so it would only need to run until the oldest operation was submitted. Then upon running the task would only check the head until it found an operation that can expire and resubmit based on its remaining time.
Also this allows for easier completion of a previous operation as all we have to do is remove the entry from the RingBuffer which is just an array offset removal and the timeout will "cancel" itself.