One of the first things I noticed after upgrading to Snow Leopard is that my Passenger based sites stopped working. I use this heavily for Rails development, so I needed it fixed. The first thing I tried was reinstalling Passenger Phusion, which led to an error.
I’ve been implementing Delayed Job to poll Twitter every minute for changes. However, it was immediately running everything and ignoring the run_at time in the database. Or so I thought.
Upon inspection of the code for Delayed Job, it is polling the database time to UTC and not local time.
def self.db_time_now (ActiveRecord::Base.default_timezone == :utc) ? Time.now.utc : Time.now end
Delayed::Job.enqueue PollTwitter.new(), 0, 1.minutes.from_now
has now become
Delayed::Job.enqueue PollTwitter.new(), 0, 1.minutes.from_now.getutc
Four hours is a large difference.
Note: Normally I would just run this as a cron job, but Heroku will only run cron once per hour.