Permalink
Browse files

Bug in rate computation from environment fixed.

  • Loading branch information...
1 parent 1ccad48 commit cea3d1c26fdfbe41d9a96a797411a6637b258b28 @benzenwen benzenwen committed Mar 19, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 writer.rb
View
@@ -39,7 +39,8 @@
uristring = ENV['MONGOLAB_URI'] || 'mongodb://localhost/testdatabase'
debug = ENV['WRITER_DEBUG'] || "false"
-rate = ENV['WRITER_RATE'].to_f || 10.0
+rate = ENV['WRITER_RATE'].to_f
+if (rate = 0.0) then rate = 10.0
uri = URI.parse(uristring)
@@ -61,7 +62,8 @@
doc['ordinal'] = i
coll.insert(doc, :safe => true)
if (debug == "true") then pp (doc) end
- sleep(1.0/rate)
+ sleep(1.0/rate)
+ print rate
end
print("Finished. Inserted ", count, " messages.\n")

0 comments on commit cea3d1c

Please sign in to comment.