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 99
1010# Determine threading/thread pool size and timeout
1111if defined? ( Puma ) && ( threads = Puma . cli_config . options . fetch ( :max_threads ) ) > 1
12- opts [ :pool ] = ( 2 * Math . log ( threads ) ) . floor
12+ opts [ :pool ] = threads
1313 opts [ :checkout_timeout ] = 10
1414else
1515 # 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)
2121
2222 # Determine threading/thread pool size and timeout
2323 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
2525 opts [ :pool_timeout ] = 10
26+ else
27+ opts [ :max_connections ] = 512
2628 end
2729
2830 Sequel . connect \
Original file line number Diff line number Diff line change @@ -36,8 +36,10 @@ def connect(dbtype)
3636 # Determine threading/thread pool size and timeout
3737 if defined? ( Puma ) &&
3838 ( threads = Puma . cli_config . options . fetch ( :max_threads ) ) > 1
39- opts [ :max_connections ] = ( 2 * Math . log ( threads ) ) . floor
39+ opts [ :max_connections ] = threads
4040 opts [ :pool_timeout ] = 10
41+ else
42+ opts [ :max_connections ] = 512
4143 end
4244
4345 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)
2828
2929 # Determine threading/thread pool size and timeout
3030 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
3232 opts [ :pool_timeout ] = 10
33+ else
34+ opts [ :max_connections ] = 512
3335 end
3436
3537 Sequel . connect \
Original file line number Diff line number Diff line change @@ -33,12 +33,10 @@ def connect(dbtype)
3333
3434 # Determine threading/thread pool size and timeout
3535 if defined? ( Puma ) && ( threads = Puma . cli_config . options . fetch ( :max_threads ) ) > 1
36- opts [ :pool ] = ( 2 * Math . log ( threads ) ) . floor
36+ opts [ :pool ] = threads
3737 opts [ :checkout_timeout ] = 10
3838 else
39- # TODO: ActiveRecord doesn't have a single-threaded mode?
40- opts [ :pool ] = 1
41- opts [ :checkout_timeout ] = 0
39+ opts [ :pool ] = 512
4240 end
4341
4442 ActiveRecord ::Base . establish_connection ( opts )
You can’t perform that action at this time.
0 commit comments