问题描述
我对Laravel http请求遇到了严重的问题.请帮我解决这个问题:
I got terrible problem with Laravel http request. Please help me to solve this:
我假设我有2个请求路由到相同的控制器:
I assumed that I have 2 requests that route to same Controller:
-
要求1: http://localhost:8000 /manualScheduler/runScript?task_name = Task (此请求需要花费很多时间才能运行2分钟左右)
Req 1: http://localhost:8000/manualScheduler/runScript?task_name=Task (This request takes much time to run around 2mins)
要求2: http://localhost:8000 /manualScheduler/detail?task_name =任务(这一步非常快)
当我解雇需求1 时,下一个是需求2 .我只是认为2个需求是分开的,这意味着需求1 和需求2 以它们自己的方式运行.但是我得到的结果是需求2 在运行需求1 时无法完成.
When I fired Req 1 then next is Req 2. I just think that 2 Reqs are separately, means Req 1 and Req 2 run in their own way. But the result I got was Req 2 could not finish when Req 1 was running.
在控制器中
- 需求1:我想运行脚本来解析带有yangqi/htmldom的HTML文件
- 需求2:我想返回一些简单的值.
已我的问题是为什么我的Req 2必须首先等待Req 1完成?我认为他们不应该相互依赖吗?或Laravel出现问题.
Edited: My question is why my Req 2 has to wait Req 1 finish first? They should not depend on each other, i think? Or some problem with Laravel.
感谢您的支持,
推荐答案
好像您正在使用默认的本地同步队列驱动程序.要获得并行处理功能,您需要使用其他驱动程序.我推荐iron.io
Looks like you are using default local synchronous queue driver. To get parallel processing capability you need to use some other driver. I recommend iron.io
更多信息来自 http://laravel.com/docs/5.0/queues#configuration
这篇关于Laravel HTTP请求:无法运行多个请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!