带有Codeigniter的PHP队列系统。怎么样? [英] PHP Queue System with Codeigniter. HOW?

查看:57
本文介绍了带有Codeigniter的PHP队列系统。怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为客户创建一个网站,他们需要能够生成25,000-100,000条码。我已经许可了生成代码的软件,但是生成一个命令大约需要20-30分钟。 60,000条码。

I am creating a website for a client where they need the ability to generate 25,000 - 100,000 barcodes. I have licensed a software that generates the codes but it takes around 20 - 30 minutes to generate an order of say. 60,000 barcodes.

所以我的问题是...

So my question is this...

是否可以使用设置的时间将php中的limit函数设置为零(无时间限制),然后使用Ajax将变量传递给库,并使用ignore_user_abort函数。这样基本上会发生以下情况:

Would it be possible to use the set time limit function in php set to zero (no time limit) and then pass the variables to the library with Ajax and use the ignore_user_abort function. This way essentially this is what would happen:

客户选择条形码的数量和类型,他们签出并在付款网关发送回SUCCESSFUL响应后,然后运行ajax请求,该请求将时间限制设置为UNLIMITED,然后告诉脚本运行,即使用户关闭其浏览器或退出页面也是如此。这样,服务器即可处理订单,而无需花费2秒或45分钟。完成订单后,客户可以刷新其帐户,他们将看到他们的订单。

Customer chooses barcode qty and type, they check out and after the payment gateway sends back a response of SUCCESSFUL, then we run an ajax request that sets the time limit to UNLIMITED and then tells the script to run even if the user closes their browser or exits the page. This way the server processes the order and it doesn't matter if it takes 2 seconds or 45 minutes. When the order is done the client can refresh their account and they would see their order.

我只是梦想着认为这听起来像是个好主意,还是一个可行的解决方案?我在使用php队列系统进行编码的岁月中没有任何经验,因此除非绝对必要,否则我不想创建一个。

Am I just dreaming to think that this sounds like a good idea or would it be a viable solution? I don't have any experience in my years of coding with php queue systems, so I don't want to have to create one unless I absolutely have to.

推荐答案

我会考虑使用类似Gearman的东西( http://gearman.org/index .php )。

I would look at using something like Gearman ( http://gearman.org/index.php ).

这也将与CI应用程序分开... CI然后将使用Gearman处理队列...

This would also be separate to the CI app ... CI will then use Gearman to process a queue...

这篇关于带有Codeigniter的PHP队列系统。怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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