Answer the question
In order to leave comments, you need to log in
How to detect the end of a series of Job tasks in laravel?
Good afternoon, I have this situation: the user can put N tasks in the queue (in real life from 1 to 20), and they all mean one process, just very finely divided into details.
How to properly organize the verification of the execution of the entire task chain? or how to determine that it was the last chain in the task that was executed and the front can call for the result?
Now the front just makes requests and checks the "status" field, which indicates the status, but I don't always manage to make the last task complete and the last one, it happens that errors occur during the script's operation and this task returns to the queue again (for each task has 8 attempts to complete)
Answer the question
In order to leave comments, you need to log in
Well, what are the options? The front is somewhere far away in the client-server system. If the front has completed the request to the server, then for him, what is the queue there, what is not the queue. Those. there are two points in the question:
1. How the front receives a status update: either it accesses the desired endpoint, or raises a web socket connection and listens.
2. How the backend understands that the Job is ready. As far as I remember, Laravel has events for this. Further implementation of event handling depends on how the front "listens" for changes - whether you set a flag for the endpoint or send an event to the socket.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question