-
-
Save jhstatewide/70ea290678ac2eda4ce1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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