Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions frameworks/Ruby/sinatra-sequel/hello_world.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ def rand1

# Test type 3: Multiple database queries
get '/queries' do
ids = ALL_IDS.sample(bounded_queries)
worlds =
DB.synchronize do
ALL_IDS.sample(bounded_queries).map do |id|
ids.map do |id|
World.with_pk(id)
end
end
Expand All @@ -79,9 +80,10 @@ def rand1
# Test type 5: Database updates
get '/updates' do
worlds = nil
ids = ALL_IDS.sample(bounded_queries)
DB.synchronize do
worlds =
ALL_IDS.sample(bounded_queries).map do |id|
ids.map do |id|
world = World.with_pk(id)
new_value = rand1
new_value = rand1 while new_value == world.randomnumber
Expand Down
6 changes: 4 additions & 2 deletions frameworks/Ruby/sinatra/hello_world.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ def rand1

# Test type 3: Multiple database queries
get '/queries' do
ids = ALL_IDS.sample(bounded_queries)
worlds =
ActiveRecord::Base.with_connection do
ALL_IDS.sample(bounded_queries).map do |id|
ids.map do |id|
World.find(id).attributes
end
end
Expand All @@ -86,8 +87,9 @@ def rand1
# Test type 5: Database updates
get '/updates' do
worlds = nil
ids = ALL_IDS.sample(bounded_queries)
ActiveRecord::Base.with_connection do
worlds = ALL_IDS.sample(bounded_queries).map do |id|
worlds = ids.map do |id|
world = World.find(id)
new_value = rand1
new_value = rand1 until new_value != world.randomNumber
Expand Down
Loading