Making acts_as_ferret thread safe?

Hi

I get a synchronize error (see below) when I run a lib script with
script/runner.

The script updates a status field in a model object that is indexed and
searchable within the script/server (mongrel) process.

$ script/runner -e production ‘load “lib/billing/credit_subscribers.rb”’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/runner.rb:27:
IOError (IOError)
from
/usr/lib/ruby/gems/1.8/gems/ferret-0.10.14/lib/ferret/index.rb:124:in
initialize' from /usr/lib/ruby/1.8/monitor.rb:229:insynchronize’
from
/usr/lib/ruby/gems/1.8/gems/ferret-0.10.14/lib/ferret/index.rb:122:in
initialize' from ./script/../config/../vendor/plugins/acts_as_ferret/lib/class_methods.rb:240:increate_index_instance’
from
./script/…/config/…/vendor/plugins/acts_as_ferret/lib/class_methods.rb:232:in
ferret_index' from ./script/../config/../vendor/plugins/acts_as_ferret/lib/instance_methods.rb:88:inferret_update’
from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/callbacks.rb:344:in
callback' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/callbacks.rb:341:incallback’
… 16 levels…
from
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/runner.rb:27
from
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in require' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:inrequire’
from script/runner:3

I’m guessing this is a lock contention issue, is it possible to
cordinate the locking performed by the plugin ?

Erik

On Tue, Jan 23, 2007 at 01:47:21AM +0100, Erik wrote:

IOError (IOError)
from
/usr/lib/ruby/gems/1.8/gems/ferret-0.10.14/lib/ferret/index.rb:124:in
`initialize’

that line does just check for the existence of the segments file inside
the index directory, maybe it’s just a file system permissions issue?

Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

Jens K. wrote:

that line does just check for the existence of the segments file inside
the index directory, maybe it’s just a file system permissions issue?

Jens

That was the problem, thank you!