But when code is running and come to this line, if this job take 5 seconds to finished, code wait 5 seconds in this line and it doesn't pass quickly from this line to run it queue later.
Notice that I use a simple curl in my job class that take 5 seconds. (in handle function).
Does your SendSimpleNotification class implement the lluminate\Contracts\Queue\ShouldQueue interface? That will instruct Laravel to run the job asynchronously - or in other words, won't cause your application to wait for the job to complete.
use Illuminate\Contracts\Queue\ShouldQueue;
class SendSimpleNotification implements ShouldQueue
{
// ...
}
class SendSimpleNotification implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct()
{
//
}
public function handle()
{
//
}
}
Have you actually configured the queue driver/connection to something other than sync, i.e. database, beanstalkd, sqs or redis? Otherwise, the jobs will just execute immediately.