需要在特定时间进行工作 [英] Need to run a job at a specific time
问题描述
我正在尝试创建一个作业,以便向Twilio呼叫发送通知,因此,拥有一个可靠的解决方案以确保作业在特定时间运行很重要(我不认为被搁置了)排入队列就足够准确了.
I'm trying to create a job in order to send a notification to a Twilio call, therefore it is important to have a robust solution that can make sure jobs are run at a specific time (I don't think being put into a queue is accurate enough).
此类任务的最佳解决方案是什么?
What is the best solution for this type of a task?
这些通知需要在通话中的特定时间发生.例如还剩1分钟".因此,它必须能够:
These notifications need to happen at a specific time in the call. Such as "1 minute left". Therefore it needs to be able to:
- 在任意时间(1:22 PM或2:45 AM)运行
- 由用户输入定义(他们设置通话时间)
(如果该解决方案可以在Heroku上运行,那就太好了
(It would be nice if that solution could run on Heroku)
推荐答案
对于您提到的特定情况,我认为您应该尝试delay_job:
https://github.com/collectiveidea/delayed_job#readme
For the specific case that you have mentioned, I think that you should give delayed_job a try:
https://github.com/collectiveidea/delayed_job#readme
它具有run_at选项,您可以在其中指定要运行作业的时间.
it has a run_at option where you can specify the time at which you want to run the job.
这篇关于需要在特定时间进行工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!