2

I have created a class library which having certain methods that get and post the API request to a third party (Hub-Spot) so Hub Spot API has some limitations as follows

***15 requests per second and 100 requests per 10 seconds ***

Currently due to this limitation in the C# class library (NET 6.0) while calling methods some of them throw errors due to the Hub-spot API limit being exceeded.

So how can I limit the number of requests in a certain period such that when the above limit exceeds then before calling methods some delay should perform so some methods do not throw an error?

Error - You have reached your ten secondly rolling limit

I was searching some articles related to that but they showed tutorials for web API and asp Core but not for the class library for limiting requests.

sarang lad
  • 23
  • 7
  • 1
    You can find a `RateLimiter` class in [this](https://stackoverflow.com/questions/65825673/partition-how-to-add-a-wait-after-every-partition "Partition: How to add a wait after every partition") question. – Theodor Zoulias Aug 10 '22 at 10:23

0 Answers0