Class: Puma::ServerPluginControl
- Inherits:
-
Object
- Object
- Puma::ServerPluginControl
- Defined in:
- lib/puma/server_plugin_control.rb
Overview
ServerPluginControl provides a control interface for server plugins to interact with and manage server settings dynamically.
This class acts as a facade between plugins and the Puma server, allowing plugins to safely modify server configuration and thread pool settings without direct access to the server’s internal state.
Instance Method Summary collapse
-
#initialize(server) ⇒ ServerPluginControl
constructor
A new instance of ServerPluginControl.
-
#max_threads ⇒ Object
Returns the maximum number of threads in the thread pool.
-
#min_threads ⇒ Object
Returns the minimum number of threads in the thread pool.
-
#update_thread_pool_min_max(min: max_threads, max: min_threads) ⇒ Object
Updates the minimum and maximum number of threads in the thread pool.
Constructor Details
#initialize(server) ⇒ ServerPluginControl
Returns a new instance of ServerPluginControl.
10 11 12 |
# File 'lib/puma/server_plugin_control.rb', line 10 def initialize(server) @server = server end |
Instance Method Details
#max_threads ⇒ Object
Returns the maximum number of threads in the thread pool.
15 16 17 |
# File 'lib/puma/server_plugin_control.rb', line 15 def max_threads @server.max_threads end |
#min_threads ⇒ Object
Returns the minimum number of threads in the thread pool.
20 21 22 |
# File 'lib/puma/server_plugin_control.rb', line 20 def min_threads @server.min_threads end |
#update_thread_pool_min_max(min: max_threads, max: min_threads) ⇒ Object
Updates the minimum and maximum number of threads in the thread pool.
28 29 30 |
# File 'lib/puma/server_plugin_control.rb', line 28 def update_thread_pool_min_max(min: max_threads, max: min_threads) @server.update_thread_pool_min_max(min: min, max: max) end |