File tree Expand file tree Collapse file tree 5 files changed +12
-8
lines changed Expand file tree Collapse file tree 5 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 9
9
10
10
# Determine threading/thread pool size and timeout
11
11
if defined? ( Puma ) && ( threads = Puma . cli_config . options . fetch ( :max_threads ) ) > 1
12
- opts [ :pool ] = ( 2 * Math . log ( threads ) ) . floor
12
+ opts [ :pool ] = threads
13
13
opts [ :checkout_timeout ] = 10
14
14
else
15
15
# TODO: ActiveRecord doesn't have a single-threaded mode?
Original file line number Diff line number Diff line change @@ -21,8 +21,10 @@ def connect(dbtype)
21
21
22
22
# Determine threading/thread pool size and timeout
23
23
if defined? ( Puma ) && ( threads = Puma . cli_config . options . fetch ( :max_threads ) ) > 1
24
- opts [ :max_connections ] = ( 2 * Math . log ( threads ) ) . floor
24
+ opts [ :max_connections ] = threads
25
25
opts [ :pool_timeout ] = 10
26
+ else
27
+ opts [ :max_connections ] = 512
26
28
end
27
29
28
30
Sequel . connect \
Original file line number Diff line number Diff line change @@ -36,8 +36,10 @@ def connect(dbtype)
36
36
# Determine threading/thread pool size and timeout
37
37
if defined? ( Puma ) &&
38
38
( threads = Puma . cli_config . options . fetch ( :max_threads ) ) > 1
39
- opts [ :max_connections ] = ( 2 * Math . log ( threads ) ) . floor
39
+ opts [ :max_connections ] = threads
40
40
opts [ :pool_timeout ] = 10
41
+ else
42
+ opts [ :max_connections ] = 512
41
43
end
42
44
43
45
Sequel . connect "%{adapter}://%{host}/%{database}?user=%{user}&password=%{password}" %
Original file line number Diff line number Diff line change @@ -28,8 +28,10 @@ def connect(dbtype)
28
28
29
29
# Determine threading/thread pool size and timeout
30
30
if defined? ( Puma ) && ( threads = Puma . cli_config . options . fetch ( :max_threads ) ) > 1
31
- opts [ :max_connections ] = ( 2 * Math . log ( threads ) ) . floor
31
+ opts [ :max_connections ] = threads
32
32
opts [ :pool_timeout ] = 10
33
+ else
34
+ opts [ :max_connections ] = 512
33
35
end
34
36
35
37
Sequel . connect \
Original file line number Diff line number Diff line change @@ -33,12 +33,10 @@ def connect(dbtype)
33
33
34
34
# Determine threading/thread pool size and timeout
35
35
if defined? ( Puma ) && ( threads = Puma . cli_config . options . fetch ( :max_threads ) ) > 1
36
- opts [ :pool ] = ( 2 * Math . log ( threads ) ) . floor
36
+ opts [ :pool ] = threads
37
37
opts [ :checkout_timeout ] = 10
38
38
else
39
- # TODO: ActiveRecord doesn't have a single-threaded mode?
40
- opts [ :pool ] = 1
41
- opts [ :checkout_timeout ] = 0
39
+ opts [ :pool ] = 512
42
40
end
43
41
44
42
ActiveRecord ::Base . establish_connection ( opts )
You can’t perform that action at this time.
0 commit comments