Skip to content

Instantly share code, notes, and snippets.

@andresilva
Created March 22, 2011 11:27
Show Gist options
  • Save andresilva/881082 to your computer and use it in GitHub Desktop.
Save andresilva/881082 to your computer and use it in GitHub Desktop.
require 'riak'
def fill_customers(n=50000)
n_threads = 4
ops_thread = n / n_threads
threads = []
n_threads.times do |i|
threads << Thread.new do
client = Riak::Client.new(:host => "10.112.29.130", :port => 8098,
:http_backend => :Excon)
ops_thread.times do |op|
if (op / 100 > 0) and (op % 100 == 0)
puts "operation #{op}"
end
end
end
end
threads.each { |thread| thread.join }
end
fill_db.rb:13:in `fill_customers': uninitialized constant Riak::Client (NameError)
from fill_db.rb:22:in `join'
from fill_db.rb:22:in `fill_customers'
from fill_db.rb:22:in `each'
from fill_db.rb:22:in `fill_customers'
from fill_db.rb:36
autoload is not thread-safe on jruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment