Facebook 图 API 速率限制和批量请求 [英] Facebook graph API rate limit and batch requests

查看:37
本文介绍了Facebook 图 API 速率限制和批量请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过一些人提到的 600 次调用/600 秒的速率限制(例如在 quora).

I've seen the 600 calls / 600 seconds rate limit mentioned by some (e.g. on quora).

我想知道的是我是否可以在 600 秒内执行 600 个batch 请求(一个批处理请求最多包含 50 个请求).

What I want to know is whether I am allowed to do 600 batch requests in 600 secs (a batch request consists of up to 50 requests).

推荐答案

您应该通过检查以下错误消息以编程方式处理速率限制.如果遇到错误,您应该在下一次调用之前放入一个时间等待循环.我的一个高流量应用程序帐户会监视此错误并会变慢.

You should handle the rate limiting programmatically by checking for the following error message. You should then put in a time-wait loop before your next call if you encounter the error. One of my high traffic applications accounts watches for this error and will slow down.

来自:https://developers.facebook.com/docs/bestpractices/

速率限制 (API_EC_TOO_MANY_CALLS) 如果您的应用程序调用过多,API 服务器可能会自动限制您的速率,返回API_EC_TOO_MANY_CALLS"错误.一般来说,这不应该发生.如果是,那是因为你的申请已经确定进行过多的 API 调用.迭代你的代码,所以你正在制作尽可能少的调用以保持用户体验需要.您还应该避免复杂的 FQL 查询.了解如果您的应用程序受到限制,请转到 Insights 并单击节流".

Rate limited (API_EC_TOO_MANY_CALLS) If your application is making too many calls, the API server might rate limit you automatically, returning an "API_EC_TOO_MANY_CALLS" error. Generally, this should not happen. If it does, it is because your application has been determined to be making too many API calls. Iterate on your code so you're making as few calls as possible in order to maintain the user experience needed. You should also avoid complicated FQL queries. To understand if your application is being throttled, go to Insights and click "Throttling".

编辑

正如 Igy 在评论线程中所报告的那样,该批次中的每个请求都计为 1.对于您的示例 600 是最大限制,这意味着您可以触发 15 个批次请求,每个请求包含 50 个调用.

As reported by Igy in the comment thread, each request in that batch counts as 1. For your example of 600 being the max limit, that means you can fire off 15 batch requests containing 50 calls each.

这篇关于Facebook 图 API 速率限制和批量请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆