-
Notifications
You must be signed in to change notification settings - Fork 125
add a separate configuration struct for pool #284
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
add a separate configuration struct for pool #284
Conversation
@@ -860,6 +860,16 @@ extension HTTPClient.Configuration { | |||
/// - warning: Cycle detection will keep all visited URLs in memory which means a malicious server could use this as a denial-of-service vector. | |||
public static func follow(max: Int, allowCycles: Bool) -> RedirectConfiguration { return .init(configuration: .follow(max: max, allowCycles: allowCycles)) } | |||
} | |||
|
|||
/// Connection pool configuration. | |||
public struct PoolConfiguration { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this Hashable
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why do you think we might need it? Also, TimeAmount
is not hashable, so this will require implementing hash(into:)
, should I add it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TimeAmount
is Hashable
as of 2.19.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As to why we need it, it's not so much that we need it as that, for trivial structures, missing Equatable
and Hashable
conformances tend to be minor annoyances. It's nicer just to have them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
/// Connection pool configuration. | ||
public struct PoolConfiguration: Hashable { | ||
// Specifies amount of time connections are kept idle in the pool. | ||
var idleTimeout: TimeAmount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, nearly missed this.
var idleTimeout: TimeAmount | |
public var idleTimeout: TimeAmount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, and merging over the complaints of the API checker because we haven't shipped any of the API we're breaking here.
Move pool idle time configuration to separate struct.
Motivation:
Right now there is only one configuration parameter for the pool, idle time, but we might have more in the future. I think it makes sense to wrap all pool-related setting in a separate struct.
Modifications:
Add PoolConfiguration struct and move idle time to that struct
Result:
All pool level settings will be in one namespace.