mardi 23 mars 2021

How to avoid user take long time to wait while controller is processing

let's me explain example

  1. User click button
  2. run function trigger in Controller
  3. User wait 30sec because MyModel::doSomeThing take long time to process

MyModel::doSomeThing do many thing. I don't want user to wait for it.

Is it possible to run MyModel::doSomeThing by don't care about result and return to user immediately?

function trigger(Request $request){ 

   $id= $request->get('id');
   MyModel::doSomeThing($id);  // this one take 30 sec.    
   return response()->json([], 200);

}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire