开发者

writing a scheduler and backend in rails

I am trying to write a very simple rails backend backed up with a mysql database. It's very simple, I have two tables, one is the users table, tweets table, and a time for each tweet. Basically besides just an API, I would like to write a scheduler for posting the tweets at a specific time in the database. This is what confuses me.. how do I write a loop in the background that always checks the current time if there's any tweet that needs to be posted?

Any recommendation/guidelines in achieving this would be helpf开发者_JAVA百科ul.


You need a background job management.

Periodically, you will check if there is anything to do and eventually do it.

Please check this relevant SO question.

Here are some other pointers:

  • http://4loc.wordpress.com/2010/03/10/background-jobs-in-ruby-on-rails/
  • https://github.com/tobi/delayed_job
  • https://github.com/javan/whenever/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜