简体   繁体   English

如何在Node.js中处理Docusign的API调用速率限制

[英]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: 好吧,您可以做两件事来最小化这一点:

Throttling 节流

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. 如果您有更多请求,则将其保存下一小时。

Caching 快取

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发出请求的需求,并且可以回答更多的用户请求(已提供您之前已对其进行缓存)。

Sum up 总结

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.

相关问题 如何使用第三方API和多个进程NodeJS处理速率限制 - How to handle rate limit w/ third party API and multiple process nodejs 您如何限制跨文件的 API 请求? [节点] - How do you rate-limit API requests across files? [nodejs] Nodejs Express,如何在调用我的 API 时限制我网站的每个用户? - Nodejs Express, How to rate limit each user of my website when calling my API? 有没有办法对 express nodejs 中的每个 api 键使用不同的速率限制? - is there a way to use different rate limit for each api key in express nodejs? 如何在环回中制定API速率限制策略 - How to make API rate limit policy in loopback Node.js-如何在不超过速率限制的情况下在for循环中调用Facebook API? - Node.js - how to call a Facebook API within a for loop without exceeding rate limit? 限制Nodejs模块请求的速率 - Rate Limit the Nodejs Module Request Docusign API 轮询/限速疑惑 - Docusign API Polling/Rate limiting doubts 如何使用微应用 Node.js 模块处理 Shopify 的 API 调用限制 - How to handle Shopify's API call limit using microapps Node.js module 如何对Google Drive API调用的速率进行限制? - How do I rate limit my Google Drive API calls?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM