2

I am trying to offload any api calls to delayed_job to make my site more responsive. Some examples would be kissmetrics logging or post to facebook.

After some mucking about I figured out that the jobs are not being processed and that I need to explicitly require the classes in the initializers/delayed_jobs_config.rb thanks to:

Rails Delayed Job & Library Class

delayed_job and rails 3 not loading jobs

However, I'm still not sure how to require these gems. Please provide an example if possible for 'Koala', 'KM', or anything really.

Community
  • 1
  • 1
TLK
  • 1,770
  • 1
  • 17
  • 32

1 Answers1

1

in initializers/delayed_jobs_config.rb

require "koala"

If that does not help you, take a look at threadsafe!

Rails does not eager load classes if the app is loaded via a rake task (and that's how DJ does its thing).

if you have that line un-commented for your environment, then I would remove that for delayed_jobs. You can accomplish that with

config.threadsafe! unless defined?($rails_rake_task) && $rails_rake_task

https://stackoverflow.com/a/12570405/643500

Community
  • 1
  • 1
Sully
  • 14,672
  • 5
  • 54
  • 79