Permalink
Browse files

add success_num for postgresql insert data action

Change-Id: Ib1a5d5eea853466e1fb4c18b3f8b9923fa1b15f6
Signed-off-by: michael zhang <zhangcheng@rbcon.com>
  • Loading branch information...
1 parent afd4aa8 commit d301ec7fda847468ca471213eff37636bd03c538 michael zhang committed Nov 2, 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 d301ec7

Please sign in to comment.