XRPL-Labs/xrpl-client

Inactive subscriptions

Opened this issue · 3 comments

(Not a bug a such, but a thought I would like to share for discussion)

The library persists a subscriptions array that is helpful in case of connection loss so we can keep the "state".

In some cases, we might want to remove certain entries from the array as they become obsolete.

For example, in the following flow:

  1. Path find create request for A
  2. Path find close request for A
  3. Path find create request for B

Even if A is not longer a path we want to explore, the path_find request gets created and closed (before path find request B) on every reconnection meaning we will receive some path messages for it for a few seconds.

I considered this before, indeed, and to keep it simple I left it. But I agree. The best way to deal with this is to "diff" subscriptions and let 2 cancel out 1 if equal. This would be tricky (not impossible) when users e.g. subscribe to certain accounts and then unsubscribe to a part of them.

Would you like a PR for this?

Would you like a PR for this?

Who would say no to that 🎉 PR for an issue/challenge/shortcoming/... is the dream of an open source maintainer :D