@@ -40,32 +40,32 @@ def impressions_count_thread
4040 @config . logger . info ( 'Posting impressions count due to shutdown' )
4141 end
4242 end
43+ end
4344
44- def post_impressions_count
45- @impressions_api . post_count ( formatter ( @impression_counter . pop_all ) )
46- rescue StandardError => error
47- @config . log_found_exception ( __method__ . to_s , error )
48- end
49-
50- def formatter ( counts )
51- return if counts . empty?
45+ def post_impressions_count
46+ @impressions_api . post_count ( formatter ( @impression_counter . pop_all ) )
47+ rescue StandardError => error
48+ @config . log_found_exception ( __method__ . to_s , error )
49+ end
5250
53- formated_counts = { pf : [ ] }
51+ def formatter ( counts )
52+ return if counts . empty?
5453
55- counts . each do |key , value |
56- key_splited = key . split ( '::' )
57-
58- formated_counts [ :pf ] << {
59- f : key_splited [ 0 ] . to_s , # feature name
60- m : key_splited [ 1 ] . to_i , # time frame
61- rc : value # count
62- }
63- end
54+ formated_counts = { pf : [ ] }
6455
65- formated_counts
66- rescue StandardError => error
67- @config . log_found_exception ( __method__ . to_s , error )
56+ counts . each do |key , value |
57+ key_splited = key . split ( '::' )
58+
59+ formated_counts [ :pf ] << {
60+ f : key_splited [ 0 ] . to_s , # feature name
61+ m : key_splited [ 1 ] . to_i , # time frame
62+ rc : value # count
63+ }
6864 end
65+
66+ formated_counts
67+ rescue StandardError => error
68+ @config . log_found_exception ( __method__ . to_s , error )
6969 end
7070 end
7171 end
0 commit comments