dosrmo0442 2018-10-15 07:10
浏览 124

Laravel在许多对象调度作业上的长循环超时。

I have 500 users. I have to run through them all and assign different things, send them an email...

For each user I am sending a email, handling some api items. This call is timing out after 30 seconds.

I am on Forge and so I have a redis working running. I am very unfamiliar with queue'ing jobs and stuff like that so forgive the noob.

My handle() function in the job is:

public function handle()
{
    Log::info('hit the job');
// assign something
// hit an api and add something to the user
// send the user and email
// save user      

}

I am calling this from a controller:

 public function activateCohort(Request $request, $id)
{
    // Get some stuff

    foreach($users as $u){
         // do something 

            ProcessActivation::dispatch($u);    
    }


    // save some stuff


    return redirect()->back()->with('message-success', 'message');
}

This all runs fine. But it only goes through about 50 users. In the future I need this to work for 1k, 2k, 5k users.

I am also not sure how to see how redis is doing.

I am at a loss for how to structure the call to work. Any help is greatly appreciated.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?
    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
    • ¥15 路易威登官网 里边的参数逆向
    • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
    • ¥50 需求一个up主付费课程