New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate option handling in Server, Server small refactors, doc changes #2373
Conversation
Could be considered breaking changes if someone is working programmatically against |
Yes, that is true. But, given that Puma is essentially a CLI app, I don't think the idea of 'what is the public API' has been given much attention. Puma is not a young app, and over time, proper encapsulation of objects often leaks. From my perspective, when I see I suppose I can revert all the attribute changes, but they just clutter up the real methods of the class. Maybe we should implement 'deprecated' warnings? I don't know. I think that the more the API is cleaned up, the easier it is for new contributors to understand how Puma works... |
I'm OK with removing write access where that write access didn't do anything (e.g. we never recheck the value after server start, so writing to the variable is a no-op). I don't think we can remove reads without a deprecation policy anymore. |
I did check what was passed to the various hooks and the plugin, I'll add back in reader code. EDIT: Rebased and added |
One issue. In server.rb:83, I changed @max_threads from |
…mall refactors, doc changes (puma#2373)" Add attr_writer's to maintain API, mark deprecated in v6.0.0.
Sorry, but this time I'm just gonna: #2388 😉 |
I've got an update that adds writers to this commit and marks them deprecated. Haven't pushed yet. It was mostly to clean up the following: class Server
attr_accessor :min_threads, :max_threads
def initialize(app, events=Events.stdio, options={})
# code
end
end
class Runner
def start_server
server = Server.new(app, events, opts)
server.min_threads = opts[:min_threads]
server.max_threads = opts[:max_threads]
# code
end
end So, we're passing |
…anges Taken from PR puma#2373, added attr_writer's to maintain API, mark deprecated in v6.0.0.
Taken from PR puma#2373, added attr_writer's to maintain API, mark deprecated in v6.0.0.
Taken from PR puma#2373, added attr_writer's to maintain API, mark deprecated in v6.0.0.
Description
In normal use, Server is passed an options hash in its initialize method. Some code is outside of Server, using attr_accessors, some of which may have been created for CI, etc. They also display in docs, which isn't needed.
server.rb - consolidate option handling, remove
attr_accessor
statements, change other lib files as needed.server.rb - Server had a method defined in
class << self
(tcp_cork_supported?
), and also a method defined asself.current
. Move current intoclass << self
block.runner.rb -
remove development?
&test?
, which are only used to set a value based on options in Server.Change test files to use
Server#instance_variable_get
Add YARD
# @!attribute
tags to methods that are actually attributes (no parameters, getter, setter, or predicate)For those interested in seeing Puma docs:
current gem https://puma.io/puma
master https://msp-greg.github.io/puma/
Your checklist for this pull request
[changelog skip]
or[ci skip]
to the pull request title.[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.