How do i integrate Hoptoad with DelayedJob and DaemonSpawn?

后端 未结 4 1800
渐次进展
渐次进展 2021-02-06 13:13

I have been happily using the DelayedJob idiom:

foo.send_later(:bar)

This calls the method bar on the object foo in the DelayedJob process.

4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-06 13:44

    Just throwing it out there - your daemon should require the rails environment that you're working on. It should look something along the lines of:

    RAILS_ENV = ARGV.first || ENV['RAILS_ENV'] || 'production'
    require File.join('config', 'environment')
    

    This way you can specify environment in which daemon is called.

    Since it runs delayed job chances are daemon already does that (it needs activerecord), but maybe you're only requiring minimal activerecord to make delayed_job happy without rails.

提交回复
热议问题