Skip to content

Instantly share code, notes, and snippets.

@jhstatewide
Created February 19, 2015 00:08
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 jhstatewide/70ea290678ac2eda4ce1 to your computer and use it in GitHub Desktop.
Save jhstatewide/70ea290678ac2eda4ce1 to your computer and use it in GitHub Desktop.
require 'bundler/setup'
require 'rethinkdb'
require 'base64'
include RethinkDB::Shortcuts
connection = r.connect(:host=>ENV['RETHINKDB_PORT_28015_TCP_ADDR'], :port => 28015)
begin
r.db_create("binary_test").run(connection)
rescue => e
end
begin
r.db("binary_test").table_create("binaries").run(connection)
rescue => e
end
data = ""
1000.times do |i|
data = SecureRandom.random_bytes(i*1024)
result = r.db("binary_test").table("binaries").insert({
:name => "test_doc_#{i}",
:image => Base64.strict_encode64(data)
}).run(connection) # hangs at around 60k bytes...
puts "Attempting save of document with size: #{data.length}"
puts result.inspect
puts "Saved ok!"
end
r.db_drop("binary_test")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment