Permalink
Browse files

Merge "add success_num for postgresql insert data action"

  • Loading branch information...
2 parents 74a9306 + d301ec7 commit 8f528d4cc01f0efe425942b5bf722df84ffdd68d michael zhang committed with Gerrit Code Review Nov 5, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 sinatra/app_sinatra_service_quota/main.rb
@@ -274,20 +274,20 @@
# populate data into postgresql table
post '/service/postgresql/tables/:name/:megabytes' do
client = load_postgresql
+ i = 0
begin
content = prepare_data(1)
client = load_postgresql
sleep 1
size = params[:megabytes].to_i
- i = 0
while i < size do
client.query("insert into #{params[:name]} (value) values('#{content}');")
sleep 1 if i % 10 == 0
i += 1
end
'ok'
rescue => e
- "#{e}"
+ "#{i}-#{e}"
ensure
client.close if client
end

0 comments on commit 8f528d4

Please sign in to comment.