Add pending callbacks to FeeService #5528
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fix guarantees a callback if there is a pending request rather than just
dropping the fee request.
When requestFee() is called the callbacks are added to a list of callBacks.
Once the next fee request completes all callbacks in the list are called
and the list cleared.
This issue popped up while testing atomic trades with the API and could likely be an issue for other usages of the API. If requestFees() is called while there is an pending request no callback is called. Since it's expected that either the resultHandler or the faultHandler is called it's not clear what happens for callers relying on the callbacks. This PR adds a guarantee one callback is called.
Also return early for the frequency check.