等待图 api / 批处理 api 的结果

发布于 2024-12-18 10:00:37 字数 112 浏览 2 评论 0原文

我怎么能不等待API调用的响应呢?

我有一大批 API 调用(一个依赖于另一个),但应用程序不需要结果。只需说“Facebook 这样做”,无需等待回复。

我怎么能不等待回复呢?

How can I not wait for response from API call?

I have a big batch of API calls (one depends on other) but application does not need the results. Just say "Facebook do this" and do not wait for response.

How can I not wait for a response?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

埋情葬爱 2024-12-25 10:00:37

不久前我参与了一个项目,我们在该项目中实现了类似的排队功能。 (该应用程序发布到大约 150 个页面的墙上以及一些其他数据收集。

我们的解决方案是这样的:

我们有一个填充有作业队列表。这些由参数令牌和特定的 Facebook API 调用组成。该表还有一个状态。列被设置为计划/成功/失败,一个响应列和几个日期时间列,计划发送

寻找计划作业的脚本,然后运行 ​​API 调用并收集由 cron 作业以任意时间间隔运行的响应。

应用程序本身可以查看队列表并生成有关已运行的作业及其响应的报告,以及即将到来的预定工作。

I was involved in a project a while back where we implemented queuing for something similar to this. (The application was posting to the walls of around 150 pages as well as some other data collection.

Our solution was this:

We had a Queue table that was populated with Jobs. These were made up of the parameters, token and the particular Facebook API call. The table also had a status column that was either set to scheduled/success/fail, a response column and a couple of datetime columns, scheduled & sent.

A script that looked for scheduled jobs, then ran the API calls and collected the response was run by a cron job at an arbitrary interval.

The application itself could look at the Queue table and produce a report of what jobs had been run and their responses, as well as the upcoming scheduled jobs.

残疾 2024-12-25 10:00:37

我相信您正在寻找一种执行异步 php 调用的方法。您最终可能会自己执行一些查询,因为我认为 PHP FB SDK 不支持此类查询。

我相信curl_multi(仅限php5)是您寻找的解决方案:

您可能还会发现此 QA 很有帮助:

I believe you are looking for a way to do a async php calls. You may end up with doing some queries by yourself, as I don't think PHP FB SDK support such queries.

I believe curl_multi (php5 only) is a solution you look for:

You may also find this QA helpful:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文