Ruby on Rails - Users Scheduling Tasks

可紊 提交于 2019-12-24 09:57:56

问题


I am working on an application which people can sign up to and schedule tasks to be done.

When the user schedules a task they enter a date and time. I want the application to wake up and send an email to the user at the date and time they have entered.

I am unsure what gems/plugins to use in rails to achieve this, anyone have a suggestion?

Cheers

Eef


回答1:


delayed_job should do the trick. It allows you to schedule tasks to run at a particular time. All you need to do is schedule a function that sends an email.




回答2:


Run a cron job every minute that runs a rake task that checks the database for any un-run tasks in the past.

This way if your system goes down (hint: it will) when you bring it back up the cronjob will pick up the slack left behind.




回答3:


There's also a backgroundrb. Also check this thread.




回答4:


The Unix 'at' command is also useful. Just execute a shell that calls 'at'.



来源:https://stackoverflow.com/questions/4210011/ruby-on-rails-users-scheduling-tasks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!