

Tweet later with Delayed Job - bryckbost
http://collectiveidea.com/blog/archives/2011/03/18/tweet-later-with-delayed-job/

======
kalak451
I really appreciate that this example shows a useful testing strategy and
handles the big scheduling gotcha (rescheduling jobs.) Neither are hard
solutions once the answer is known, but having them spelled out will save
someone a lot of time.

------
pavel_lishin
> What if you wanted to have a message scheduled to be tweeted 10 minutes
> before a blog was published?

Why?

~~~
zmoazeni
That example may be contrived, but I've had a few projects in the past where I
had to schedule tweets and this strategy is pretty slick and testable.

------
tedjdziuba
Seems like a lot of effort to avoid using cron.

~~~
danielmorrison
I disagree. Cron is meant to run at specific intervals, not at specific,
arbitrary times.

In apps where we're using this technique, we may have hundreds or thousands of
jobs scheduled at various times in the future (appointment reminders are a
great example). Cron would have to check every minute or two, whereas we have
Delayed Job already running a queue. They just get pulled in when their time
is right.

~~~
pavel_lishin
How does delayed_job work? Does it just run as a daemon in the background?

~~~
bryckbost
Yep, it runs in the background.

`script/delayed_job` can be used to manage the process or `rake jobs:work`.
Either will start working off jobs.

