you need to use laravel queues (redis drivers) to implement code execution asynchronously without delay, such as
$stock = 5;
$job = new DecStock ();
$this- > dispatch ($job);
return $stock;
the purpose is to return the variable $stock as soon as possible and execute a queue asynchronously for some processing
found that in DecStock job, if there is no implement IlluminateContractsQueueShouldQueue;
, it is impossible to wait for the queue execution to return $stock
asynchronously, but it can be inherited asynchronously with a delay of 1-2 seconds (probably not the time it takes to get in and out of the queue. )
how to implement queue execution without delay? Or do not use the queue, is there any other plan?