@@ -22,9 +22,9 @@ def failed_tests
2222 end
2323
2424 def pop_warnings
25- warnings = redis . multi do
26- redis . lrange ( key ( 'warnings' ) , 0 , -1 )
27- redis . del ( key ( 'warnings' ) )
25+ warnings = redis . multi do | transaction |
26+ transaction . lrange ( key ( 'warnings' ) , 0 , -1 )
27+ transaction . del ( key ( 'warnings' ) )
2828 end . first
2929
3030 warnings . map { |p | Marshal . load ( p ) }
@@ -35,21 +35,21 @@ def record_warning(type, attributes)
3535 end
3636
3737 def record_error ( id , payload , stats : nil )
38- redis . pipelined do
39- redis . hset (
38+ redis . pipelined do | pipeline |
39+ pipeline . hset (
4040 key ( 'error-reports' ) ,
4141 id . dup . force_encoding ( Encoding ::BINARY ) ,
4242 payload . dup . force_encoding ( Encoding ::BINARY ) ,
4343 )
44- record_stats ( stats )
44+ record_stats ( stats , pipeline : pipeline )
4545 end
4646 nil
4747 end
4848
4949 def record_success ( id , stats : nil )
50- redis . pipelined do
51- redis . hdel ( key ( 'error-reports' ) , id . dup . force_encoding ( Encoding ::BINARY ) )
52- record_stats ( stats )
50+ redis . pipelined do | pipeline |
51+ pipeline . hdel ( key ( 'error-reports' ) , id . dup . force_encoding ( Encoding ::BINARY ) )
52+ record_stats ( stats , pipeline : pipeline )
5353 end
5454 nil
5555 end
@@ -65,8 +65,8 @@ def error_reports
6565 end
6666
6767 def fetch_stats ( stat_names )
68- counts = redis . pipelined do
69- stat_names . each { |c | redis . hvals ( key ( c ) ) }
68+ counts = redis . pipelined do | pipeline |
69+ stat_names . each { |c | pipeline . hvals ( key ( c ) ) }
7070 end
7171 sum_counts = counts . map do |values |
7272 values . map ( &:to_f ) . inject ( :+ ) . to_f
@@ -75,9 +75,9 @@ def fetch_stats(stat_names)
7575 end
7676
7777 def reset_stats ( stat_names )
78- redis . pipelined do
78+ redis . pipelined do | pipeline |
7979 stat_names . each do |stat_name |
80- redis . hdel ( key ( stat_name ) , config . worker_id )
80+ pipeline . hdel ( key ( stat_name ) , config . worker_id )
8181 end
8282 end
8383 end
@@ -86,10 +86,10 @@ def reset_stats(stat_names)
8686
8787 attr_reader :config , :redis
8888
89- def record_stats ( stats )
89+ def record_stats ( stats , pipeline : redis )
9090 return unless stats
9191 stats . each do |stat_name , stat_value |
92- redis . hset ( key ( stat_name ) , config . worker_id , stat_value )
92+ pipeline . hset ( key ( stat_name ) , config . worker_id , stat_value )
9393 end
9494 end
9595
0 commit comments