Navigation Menu

Skip to content

Commit

Permalink
inplace reporter: reduce the number of redraws
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 11, 2012
1 parent e0432ac commit 8341b80
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/groonga/tester.rb
Expand Up @@ -1591,6 +1591,8 @@ class InplaceReporter < BaseReporter
def initialize(tester)
super
@mutex = Mutex.new
@last_redraw_time = Time.now
@minimum_redraw_interval = 0.1
end

def start(result)
Expand Down Expand Up @@ -1709,12 +1711,16 @@ def draw_progress_line

def redraw
@mutex.synchronize do
unless block_given?
return if Time.now - @last_redraw_time < @minimum_redraw_interval
end
draw
if block_given?
yield
else
up_n_lines(n_using_lines)
end
@last_redraw_time = Time.now
end
end

Expand Down

0 comments on commit 8341b80

Please sign in to comment.