File tree Expand file tree Collapse file tree 4 files changed +3
-12
lines changed Expand file tree Collapse file tree 4 files changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -51,15 +51,6 @@ Naming/HeredocDelimiterNaming:
51
51
Exclude :
52
52
- ' tasks/compile.rake'
53
53
54
- # Offense count: 3
55
- # Cop supports --auto-correct.
56
- # Configuration parameters: AutoCorrect.
57
- Performance/TimesMap :
58
- Exclude :
59
- - ' benchmark/active_record_threaded.rb'
60
- - ' examples/threaded.rb'
61
- - ' spec/mysql2/client_spec.rb'
62
-
63
54
# Offense count: 2
64
55
# Cop supports --auto-correct.
65
56
# Configuration parameters: EnforcedStyle, SupportedStyles.
Original file line number Diff line number Diff line change 14
14
ActiveRecord ::Base . establish_connection ( opts . merge ( :adapter => adapter ) )
15
15
16
16
x . report ( adapter ) do
17
- number_of_threads . times . map do
17
+ Array . new ( number_of_threads ) do
18
18
Thread . new { ActiveRecord ::Base . connection . execute ( 'SELECT SLEEP(1)' ) }
19
19
end . each ( &:join )
20
20
end
Original file line number Diff line number Diff line change 6
6
7
7
# Should never exceed worst case 3.5 secs across all 20 threads
8
8
Timeout . timeout ( 3.5 ) do
9
- 20 . times . map do
9
+ Array . new ( 20 ) do
10
10
Thread . new do
11
11
overhead = rand ( 3 )
12
12
puts ">> thread #{ Thread . current . object_id } query, #{ overhead } sec overhead"
Original file line number Diff line number Diff line change @@ -658,7 +658,7 @@ def run_gc
658
658
sleep_time = 0.5
659
659
660
660
# Note that each thread opens its own database connection
661
- threads = 5 . times . map do
661
+ threads = Array . new ( 5 ) do
662
662
Thread . new do
663
663
new_client do |client |
664
664
client . query ( "SELECT SLEEP(#{ sleep_time } )" )
You can’t perform that action at this time.
0 commit comments