A
A
Andrey Pavlenko2016-05-27 16:41:45
PHP
Andrey Pavlenko, 2016-05-27 16:41:45

How to implement queue with scheduled time?

Good afternoon!
Instead of a solution in the form of RabbitMQ, I implemented a more compact version with Redis blpop and rpush methods.
The bottom line is that the server polls some pages in the background.
If they return an incorrect response, you should try to repeat the task in 10 minutes.
It turns out that in this case, blpop / rpush will not work, since everything goes there instantly.
What solutions do I see:
1) Run the script every 10 minutes via cron. Disadvantages - there is no guarantee that everything will work with the desired range
2) create another queue in Redis, in which, in addition to the link, indicate the time and check every few minutes whether it is time to resend the request
3) implement the same on MySQL
Perhaps there are more elegant ways to implement such tasks?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Shatokhin, 2016-05-27
@Akdmeh

There are different ways. Normal - beanstalk or RabbitMQ. Both have the functionality of deferred tasks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question