M
M
mrdragon90002019-08-09 15:17:13
Laravel
mrdragon9000, 2019-08-09 15:17:13

How to loop through code in laravel?

There are unlimited VK pages. I need to constantly monitor changes on them, as soon as an update appears on any, I need to enter these updates into my database.
I'm thinking of doing this in Laravel's turn of the queue (run 10 workers at the same time). Make a Job that will check information about the transferred VK page. When the Job is finished, it will add a copy of itself to the end of the queue to check the page information again. The only problem is that if this Job fails (I know about the automatic restart of failed Jobs, but suddenly all attempts to restart fail), it will not restart itself. How to solve this problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Shumov, 2019-08-09
@inoise

In normal queues, if the job has not been completed, then it will return to the queue itself, you can even configure when. I don't know what's in Laravel out of the box, but the logic is generally good. Although I would take the filling of the queue into a separate mechanism, because pages can become both more and less over time, and such an algorithm goes into a fixed cycle

A
Arthur, 2019-08-09
@astralo

Why not try adding a helper to check if a job is in the queue and limit it to one run, but through the scheduler? Then it will definitely throw to the end and automatically select the worker

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question