views:

229

answers:

2

I'm using delayed_job to process some files and then create some activerecord objects with the results. The activerecord objects are being indexed with acts_as_ferret which is running as a drb server. When delayed_job processes the job, everything goes fine until it reaches the point when active record tries to talk to ferret via the drb server.

The stack trace is here: http://pastie.org/693588

Calling the same process via the console or without delayed_job is successful. My guess is that for some reason, possibly permissions related, delayed_job doesn't have the ability to talk to the drb server, but not sure. Any ideas what's going on?

A: 

Agreed with the commenter, post some code! :-)

However, in the absense of code, it's too hard to figure out what went wrong. And how or why is DJ talking to the drb server, which is used for user searches? Is it restarting it? AAF takes care of indexing on each request, so if you are processing some job in the background, how does that effect the index in a database?

pjammer
+1  A: 

Wow - I posted the same question on Nov 5th. So, I must be on the right track at least! :)

http://stackoverflow.com/questions/1679043/delayedjob-with-actsasferret-in-production-mode

To help with giving some more context to the question:- there is no special code I had written. The models all have

acts_as_ferret :remote => true

The ferret_server initializer is as usual:

$ cat config/ferret_server.yml 
# configuration for the acts_as_ferret DRb server
# host: where to reach the DRb server (used by application processes to contact the server)
# port: which port the server should listen on
# pid_file: location of the server's pid file (relative to RAILS_ROOT)
# log_file: log file (default: RAILS_ROOT/log/ferret_server.log
# log_level: log level for the server's logger
production:
  host: localhost
  port: 9010
  pid_file: log/ferret.pid
  log_file: log/ferret_server.log
  log_level: warn

I am able to run other delayed_job which do NOT modify the records but gather data - so delayed_job works. This is the delayed_job spawner I have:

$ cat script/delayed_job 
#!/usr/bin/env ruby

ENV['RAILS_ENV'] = 'production'
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'boot'))
require 'delayed/command'

Delayed::Command.new(ARGV).daemonize
Gautam Rege