当我执行从关联的 Web 应用程序访问我的 Cloudant 数据库的某个函数时,我在 Node.js 控制台窗口中收到以下错误:
"Error: You've exceeded your current limit of 5 requests per second for query class".
我在 Chrome 网络浏览器中收到此相应错误:
"MethodHubFrontend-1.1.0.js:32 POST http://cognitivehub.w3ibm.mybluemix.net/api/export/archive 500 (Internal Server Error)".
我们的应用程序通过 Cloudant Lite 服务在 Bluemix Dedicated (CIO) 上运行。是什么导致了这些错误?是因为我们超出了 Cloudant Lite 中每秒 5 个查询的吞吐量限制吗?
除了每秒提供 50 个查询的选项之外,Cloudant Standard 中是否还有其他选项供我们使用?
我们应该如何处理 Node.js 服务器中的错误,以便它返回 3xx 错误代码而不是 500 错误代码?
最佳答案
What is causing these errors? Is it because we are exceeding the 5 queries per second throughput limitation in Cloudant Lite?
是的,你是对的。您需要升级到标准计划才能提高费率限制。请查看 Cloudant Web 控制台的“帐户”选项卡中的详细信息,以了解更多信息。
Is there an option in Cloudant Standard, other than the one that provides 50 queries per second, which we could use?
有多个级别,如帐户> 容量选项卡中所列。
Also, how should we be handling the error in our Node.js server so it returns a 3xx error code instead of the 500 error code?
Cloudant 应返回 HTTP 代码 429(请求过多)。您的应用可以通过两种方式响应此错误情况 - 失败或重新发送请求。
关于node.js - 我在使用 Cloudant Lite 服务的 Bluemix 上的 Node.js Web 应用程序中收到 500 查询错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41621153/