Commit c68d20d71a2cff9d52204a7eabfb6afff8f2ef93
1 parent
e98b918f
Exists in
master
and in
29 other branches
Fix problem with Delayed::Job and acts_as_ferret
For some reason when the Profile class is loaded while InvitationJob is being performed there is an IOError error caused by acts_as_ferret's DRB server. By trial and error I found out that if the class is loaded during delayed_job startup, then that problem does not occur. WTF? (ActionItem1640)
Showing
2 changed files
with
5 additions
and
8 deletions
Show diff stats
lib/invitation_job.rb
1 | 1 | class InvitationJob < Struct.new(:person_id, :contacts_to_invite, :message, :profile_id, :contact_list_id) |
2 | 2 | def perform |
3 | - begin | |
4 | - person = Person.find(person_id) | |
5 | - profile = Profile.find(profile_id) | |
6 | - Invitation.invite(person, contacts_to_invite, message, profile) | |
7 | - ContactList.find(contact_list_id).destroy | |
8 | - rescue ActiveRecord::NotFound => e | |
9 | - #... | |
10 | - end | |
3 | + person = Person.find(person_id) | |
4 | + profile = Profile.find(profile_id) | |
5 | + Invitation.invite(person, contacts_to_invite, message, profile) | |
6 | + ContactList.find(contact_list_id).destroy | |
11 | 7 | end |
12 | 8 | end | ... | ... |
script/delayed_job
... | ... | @@ -9,6 +9,7 @@ |
9 | 9 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) |
10 | 10 | require 'daemons' |
11 | 11 | require 'delayed/command' |
12 | +require 'app/models/profile' | |
12 | 13 | |
13 | 14 | ENV['RAILS_ENV'] ||= "production" |
14 | 15 | Delayed::Command.new(ARGV).daemonize | ... | ... |