Laravel http request: Cannot run multiple request

2019-04-10 14:25发布

问题:

I got terrible problem with Laravel http request. Please help me to solve this:

I assumed that I have 2 requests that route to same Controller:

  • Req 1: http://localhost:8000/manualScheduler/runScript?task_name=Task (This request takes much time to run around 2mins)

  • Req 2:http://localhost:8000/manualScheduler/detail?task_name=Task ( this one is very quick)

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.

In controller,

  • Req 1: I want to run script to parse HTML file with yangqi/htmldom
  • Req 2: I want to return some simple value.

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.

Thanks for your support,

回答1:

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

More info from http://laravel.com/docs/5.0/queues#configuration