Skip to content

Instantly share code, notes, and snippets.

@estolfo
Last active March 21, 2018 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save estolfo/f6a46b68fdf3db9be102ba2236e7abd5 to your computer and use it in GitHub Desktop.
Save estolfo/f6a46b68fdf3db9be102ba2236e7abd5 to your computer and use it in GitHub Desktop.
client = Mongo::Client.new(["localhost:3000", "localhost:3001", "localhost:3002"], truncate_logs: false)
coll = client[:test, read: { mode: :secondary_preferred }]
sleep_intervals = [ 10, 700, 1 ]
coll.find({}, no_cursor_timeout: true, batch_size: 1).each_with_index do |doc, i|
doc
puts "sleeping for #{sleep_intervals[i]} seconds"
sleep(sleep_intervals[i])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment