lib/lhm/chunker.rb in lhm-1.0.0.rc.1 vs lib/lhm/chunker.rb in lhm-1.0.0.rc2

- old
+ new

@@ -27,11 +27,11 @@ # Copies chunks of size `stride`, starting from id 1 up to id `limit`. # def up_to(limit) traversable_chunks_up_to(limit).times do |n| - yield(bottom(n + 1), top(n + 1, limit)) && sleep(throttle_seconds) + yield(bottom(n + 1), top(n + 1, limit)) end end def traversable_chunks_up_to(limit) (limit / @stride.to_f).ceil @@ -57,17 +57,21 @@ @cols ||= @migration.intersection end def execute up_to(@limit) do |lowest, highest| - print "." + affected_rows = update(copy(lowest, highest)) - sql copy(lowest, highest) + if affected_rows > 0 + sleep(throttle_seconds) + end + + print "." end end def throttle_seconds - @throttle / 100.0 + @throttle / 1000.0 end end end