Skip to content

Instantly share code, notes, and snippets.

@hobodave
Created May 19, 2017 18:48
Show Gist options
  • Save hobodave/9c6ad907a01b9fdb710a5275b459a32f to your computer and use it in GitHub Desktop.
Save hobodave/9c6ad907a01b9fdb710a5275b459a32f to your computer and use it in GitHub Desktop.
CONCURRENCY = 100 # Ensure adequate pool size in database.yml
barrier = Concurrent::CyclicBarrier.new(CONCURRENCY)
jobs = Array.new(CONCURRENCY) do
lambda do
begin
Node.last
rescue => e
puts e
puts e.backtrace.to_a
end
end
end
process = lambda do |i|
barrier.wait
begin
Rails.application.executor.wrap { jobs[i].call }
ensure
barrier.wait
end
end
threads = CONCURRENCY.times.map { |i| Thread.new(i, &process) }
=begin
undefined method `default_scope_override' for Node (call 'Node.connection' to establish a connection):Class
Did you mean? default_scope_override=
org/jruby/RubyBasicObject.java:1653:in `method_missing'
/Users/davida/.rvm/gems/jruby-9.1.9.0@backbeat/gems/activerecord-5.0.3/lib/active_record/dynamic_matchers.rb:21:in `method_missing'
/Users/davida/.rvm/gems/jruby-9.1.9.0@backbeat/gems/activerecord-5.0.3/lib/active_record/scoping/default.rb:109:in `build_default_scope'
/Users/davida/.rvm/gems/jruby-9.1.9.0@backbeat/gems/activerecord-5.0.3/lib/active_record/scoping/named.rb:33:in `default_scoped'
/Users/davida/.rvm/gems/jruby-9.1.9.0@backbeat/gems/activerecord-5.0.3/lib/active_record/scoping/named.rb:28:in `all'
/Users/davida/.rvm/gems/jruby-9.1.9.0@backbeat/gems/activerecord-5.0.3/lib/active_record/querying.rb:3:in `last'
(irb):8:in `block in evaluate'
(irb):19:in `block in evaluate'
/Users/davida/.rvm/gems/jruby-9.1.9.0@backbeat/gems/activesupport-5.0.3/lib/active_support/execution_wrapper.rb:85:in `wrap'
(irb):19:in `block in evaluate'
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment