pat / ts-delayed-delta

Manage delta indexes via Delayed Job for Thinking Sphinx
http://ts.freelancing-gods.com
MIT License
73 stars 33 forks source link

Fix Rails 5 deprecation in cancel_jobs #52

Closed JasonBarnabe closed 8 years ago

JasonBarnabe commented 8 years ago
jason@jason-X550CA:/www/greasyfork$ rake ts:index
Generating configuration to /www/greasyfork/config/development.sphinx.conf
rake aborted!
ActiveSupport::DeprecationException: DEPRECATION WARNING: Passing conditions to delete_all is deprecated and will be removed in Rails 5.1. To achieve the same use where(conditions).delete_all. (called from load at /home/jason/.rvm/gems/ruby-2.3.1@greasyfork/bin/rake:22)
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/gems/activerecord-5.0.0.1/lib/active_record/relation.rb:528:in `delete_all'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/gems/newrelic_rpm-3.16.3.323/lib/new_relic/agent/instrumentation/active_record_helper.rb:54:in `block in delete_all'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/gems/newrelic_rpm-3.16.3.323/lib/new_relic/agent.rb:586:in `with_database_metric_name'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/gems/newrelic_rpm-3.16.3.323/lib/new_relic/agent/instrumentation/active_record_helper.rb:53:in `delete_all'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/gems/activerecord-5.0.0.1/lib/active_record/querying.rb:8:in `delete_all'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/gems/ts-delayed-delta-2.0.2/lib/thinking_sphinx/deltas/delayed_delta.rb:18:in `cancel_jobs'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/gems/ts-delayed-delta-2.0.2/lib/thinking_sphinx/deltas/delayed_delta.rb:142:in `block in <top (required)>'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/gems/thinking-sphinx-3.2.0/lib/thinking_sphinx/rake_interface.rb:37:in `block in index'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/gems/thinking-sphinx-3.2.0/lib/thinking_sphinx/rake_interface.rb:37:in `each'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/gems/thinking-sphinx-3.2.0/lib/thinking_sphinx/rake_interface.rb:37:in `index'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/gems/thinking-sphinx-3.2.0/lib/thinking_sphinx/tasks.rb:9:in `block (2 levels) in <top (required)>'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/bin/ruby_executable_hooks:15:in `eval'
/home/jason/.rvm/gems/ruby-2.3.1@greasyfork/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => ts:index
(See full trace by running task with --trace)

This PR fixes that. The rest of the code seems to support all the way back to Rails 2, so I've maintained that support.

I also added a missing dependency on activerecord. This would've been included because it comes comes with thinking-sphinx anyway, but since we're referencing activerecord stuff it seems correct to specify it.

pat commented 8 years ago

Thanks Jason, greatly appreciated :)

lunaru commented 6 years ago

@pat could you package master (and especially this PR) into a new version 2.0.3? It would be great to use ts-delayed-delta in our Gemfile without pinning to a github commit hash. It's been almost 4 years since the last gem push. Thanks!

pat commented 6 years ago

Completely fair call, thanks for the reminder - I've just released 2.1.0 :)

lunaru commented 6 years ago

thanks! 2.1.0 is working great.