File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
Expand file tree Collapse file tree 3 files changed +8
-6
lines changed 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 @@ -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