[英]How to handle the API call rate limit for Docusign in nodejs
如何处理nodejs中Docusign的API调用速率限制?我收到类似“超过每小时API调用的最大次数”之类的错误。
So, you hit your QPH (queries per hour) limit, right? 因此,您达到了QPH(每小时查询)的限制,对吗?
Well, there are two things you can do to minize that: 好吧,您可以做两件事来最小化这一点:
When an application has a query limit per period of time, throttling is often a common strategy used. 当应用程序每个时间段都具有查询限制时,节流通常是常用的策略。
Throttling revolves around distributing your requests over a period of time. 节流围绕在一段时间内分发您的请求。 So for example, if you have a 500 limit of requests per hour, you can throttle your application to do 250 requests in the first 30 minutes, and 250 after.
因此,例如,如果每小时的请求限制为500个,则可以限制应用程序在前30分钟内执行250个请求,然后在250分钟后进行250个请求。
This way you avoid hitting the limit. 这样您可以避免达到极限。 If you have more requests, then you save them for the next hour.
如果您有更多请求,则将其保存下一小时。
Throttling is good because it gives you control over time. 节流是件好事,因为它可以让您控制时间。 But sometimes, requests are similar, so similar in fact that you can just save the answer and use it for later.
但是有时,请求是相似的,实际上是如此相似,以至于您可以保存答案并将其用于以后。
Caching is also often used together with throttling, by saving the answers from old requests in your system, and re-using them, you effectively loose the need to make requests against the API, and you gain the ability to answer more user requests (provided you cached them before). 缓存还经常与限制一起使用,通过将旧请求中的答案保存在系统中并重新使用它们,可以有效地减少针对API发出请求的需求,并且可以回答更多的用户请求(已提供您之前已对其进行缓存)。
There is no silver bullet to solve your problem. 没有解决问题的灵丹妙药。 There is no simple line of code to do that.
没有简单的代码行可以做到这一点。 Instead, you have two methods that used together will minimize your problem and perhaps even eliminate it altogether if used correctly.
相反,您有两种方法结合使用,可以最大程度地减少问题,甚至在正确使用的情况下也可以完全消除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.