Z
Z
Zohei2014-10-24 12:47:59
Task Schedulers
Zohei, 2014-10-24 12:47:59

How to make a task run once at a given time?

Good afternoon!
What are the tools for performing one-time tasks of the same type at a given time?
Real life example in general terms: A
customer places a pre-order with the delivery service of a store that is currently closed. Notification of the order by SMS goes nowhere, because. for various reasons beyond the control of the developer, the performer may ignore orders that fell to him at night.
There are many shops and performers and the opening hours are different for everyone.
You need to somehow do a delayed notification at a given time.
For example, at 9:00 send an SMS with order No. 1 to Vasily, and at 11:23 order No. 4 to Petrovich.
I'm not sure that a cron script that checks every minute and compares the time of the order with the opening time of the institution is a good solution.
I hope for your experience in solving similar problems, thanks in advance)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kir, 2014-10-24
@angry_bender

I solved a similar task just through the cron script and time verification), while the task is placed in a special table in the database indicating the time when it should be "launched".
I don't think that this decision is absolutely bad, and here's why:
1. No message manager supports deferred messages in the stable branch, because AMQP protocol doesn't support deferred delivery in principle
. 2. The solution via cron is absolutely stable compared to a separate php daemon: the probability of crond crash is practically zero.
3. Ease of debugging (compared to a separate php daemon).
4. Practically "distorted" integration of the request/message queue with the site's admin panel.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question