How does Laravel implement a timer task?

Source: Internet
Author: User
Let's talk about the general situation first. The framework uses Laravel, the task queue uses Beanstalkd, and then {code ...} now I have a crawler task that needs to run every other time. During the crawling process, the crawler will add some subtasks to the task queue. For the next crawler task, you need to wait for the previous crawler to... let's talk about the general situation first. The framework uses Laravel and the task queue uses Beanstalkd.

Php artisan queue: listen

Now I have a crawler task that needs to run every other time. During the crawling process, the crawler will add some subtasks to the task queue.

The next crawler task can be started only after all the previous crawler tasks are completed.

However, the time used by the crawler task is unknown, and no method is found to determine whether the task queue is empty.

So how can I decide when (or under what conditions) to add the next crawler task to the task queue?

Reply content:

Let's talk about the general situation first. The framework uses Laravel and the task queue uses Beanstalkd.

Php artisan queue: listen

Now I have a crawler task that needs to run every other time. During the crawling process, the crawler will add some subtasks to the task queue.

The next crawler task can be started only after all the previous crawler tasks are completed.

However, the time used by the crawler task is unknown, and no method is found to determine whether the task queue is empty.

So how can I decide when (or under what conditions) to add the next crawler task to the task queue?

Search cron

I have not yet thought of a particularly good solution. I have the opportunity to discuss it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.