I have access to an API call that accepts maximum call speed per second . If the speed is exceeded, an exception is selected .
I would like to wrap this call in an abstraction, which makes it necessary to maintain the speed of the call under the limit. It will act as a network router: handle several calls and return the results to the right party, taking care of the speed of the call. The goal is to make the calling code as unpredictable as possible with respect to this restriction. Otherwise, each part of the code with this call must be wrapped in try-catch!
For example: Imagine that you can call a method from the extern API that can add 2 numbers. This API can be called 5 times per second . Anything above this will result in an exception.
To illustrate this problem, an external service that limits call speed is similar to the one that answers this question.
How to create speed limit APIs using Observables?
ADDITIONAL INFORMATION:
Since you do not want to worry about this limitation every time you call this method from any part of your code, you are thinking of developing a wrapper method that you could call without worrying about the speed limit. From the inside, you care about the limit, but from the outside you will find a simple asynchronous method.
-. ?
, . .
?
,
public async Task<Results> MyMethod()
, , Reactive Extensions (Buffer). .
? , . ?
!