Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delta Indexing - Delayed Jobs is not working

The code is working fine with delayed jobs and its making queue in delayed_jobs table and workers are processing them, but still we are getting exception on destroying object

here is the trace

vendor/bundle/ruby/1.9.1/gems/riddle-1.5.1/lib/riddle/client.rb:639:in `recv'
vendor/bundle/ruby/1.9.1/gems/riddle-1.5.1/lib/riddle/client.rb:639:in `block in request'
vendor/bundle/ruby/1.9.1/gems/riddle-1.5.1/lib/riddle/client.rb:538:in `connect'
vendor/bundle/ruby/1.9.1/gems/riddle-1.5.1/lib/riddle/client.rb:623:in `request'
vendor/bundle/ruby/1.9.1/gems/riddle-1.5.1/lib/riddle/client.rb:226:in `run'
vendor/bundle/ruby/1.9.1/gems/riddle-1.5.1/lib/riddle/client.rb:338:in `query'
vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-2.0.10/lib/thinking_sphinx/search.rb:414:in `block (2 levels) in populate'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `instrument'
vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-2.0.10/lib/thinking_sphinx/search.rb:518:in `log'
vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-2.0.10/lib/thinking_sphinx/search.rb:527:in `log'
vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-2.0.10/lib/thinking_sphinx/search.rb:413:in `block in populate'
vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-2.0.10/lib/thinking_sphinx/search.rb:568:in `call'
vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-2.0.10/lib/thinking_sphinx/search.rb:568:in `retry_on_stale_index'
vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-2.0.10/lib/thinking_sphinx/search.rb:411:in `populate'
vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-2.0.10/lib/thinking_sphinx/search.rb:176:in `method_missing'
vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-2.0.10/lib/thinking_sphinx/search_methods.rb:395:in `search_for_id'
vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-2.0.10/lib/thinking_sphinx/active_record.rb:268:in `delete_in_index'
vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-2.0.10/lib/thinking_sphinx/active_record.rb:348:in `block in toggle_deleted'
vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-2.0.10/lib/thinking_sphinx/active_record.rb:34
.
.
.
app/controllers/received_messages_controller.rb:142:in `destroy'

The question when delayed job delta has been added then why its trying to hit thinking sphinx directly ?

Here is the define index bloc

  define_index do
    if Rails.env.production?
      set_property :delta => FlyingSphinx::DelayedDelta
    else
      set_property :delta => true
    end

    indexes message.subject

    has user_id, read, created_at

    where "users_user_messages.is_active = 'Y'"

  end
like image 231
Gul Avatar asked Nov 04 '22 18:11

Gul


1 Answers

What's happening here is that Thinking Sphinx is checking whether the object exists in Sphinx before marking it as deleted - and the only way to do that is to search for it. There is some error handling that's built into Thinking Sphinx though, that should catch (and ignore) errors from Sphinx, so I'm a little unsure as to why you're seeing exceptions being raised.

Can you share the error description that appears before the stack trace?

Also, this is unrelated to Delayed Job.

like image 154
pat Avatar answered Nov 16 '22 22:11

pat