up-cpp icon indicating copy to clipboard operation
up-cpp copied to clipboard

Remove pending requests from the RpcClient's expiration queue when responses are received

Open gregmedd opened this issue 1 year ago • 0 comments

I think what I'm going to have to do to address this issue is

  1. Add the request ID to the PendingRequest struct
  2. Add a second scrub() method to ScrubablePendingQueue that takes a UUID to scrub a single request
  3. Add a second scrub() method to ExpireWorker that takes a UUID and puts it in a scrub queue for deferred scrubbing (and then wakes the worker thread)
  4. Modify the callback wrapper such that it calls that scrub() method on the ExpireService for the request ID inside of the call_once section and after the message has been passed to the caller.

Testing this is also going to be somewhat challenging. There isn't a direct way to observe if the request is still in the pending queue. I think I would need to add a protected bool pending(v1::Uuid) method to RpcClient (along with the supporting methods in the expiration service infrastructure). Then the test could inherit from RpcClient and use that pending() method to check.

I'm a little nervous about the scope of that change and the possible interactions this close to a release. @billpittman - how bad do you think this issue is, and could we possibly take it as an improvement in alpha.3?

Originally posted by @gregmedd in https://github.com/eclipse-uprotocol/up-cpp/pull/202#discussion_r1674896431

gregmedd avatar Jul 12 '24 00:07 gregmedd