- Notifications
You must be signed in to change notification settings - Fork 136
Add a waiter box for the connection pool#397
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
| let id: ID | ||
| let request: HTTPScheduledRequest | ||
| let eventLoopRequirement: EventLoop? |
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.
In general for good hygiene I'd recommend these being var instead of let.
| let request: HTTPScheduledRequest | ||
| let eventLoopRequirement: EventLoop? | ||
| init(request: HTTPScheduledRequest, eventLoopRequirement: EventLoop?){ |
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.
Is there a reason we take the preference separately from the HTTPScheduledRequest, which encodes a preference?
0266fef to f92aa7aCompare| extension HTTPConnectionPool{ | ||
| struct Waiter{ | ||
| struct ID: 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.
What a great idea ;)
| var id: ID{ | ||
| ID(self.request) | ||
| } | ||
| var request: HTTPScheduledRequest{ | ||
| didSet{ | ||
| self.updateEventLoopRequirement() | ||
| } | ||
| } |
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.
Hmm, this feels a bit off. If we can the request then the id of the waiter also changes. Is that the behaviour we actually want or should it really be called requestID?
| struct RequestID: Hashable{ | ||
| private let objectIdentifier: ObjectIdentifier | ||
| init(_ request: HTTPScheduledRequest){ | ||
| self.objectIdentifier = ObjectIdentifier(request) | ||
| } | ||
| } | ||
| struct Waiter{ | ||
| var requestID: RequestID{ | ||
| RequestID(self.request) | ||
| } | ||
| var request: HTTPScheduledRequest{ | ||
| didSet{ | ||
| self.updateEventLoopRequirement() | ||
| } | ||
| } |
fabianfettJul 8, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
@glbrntt Changed to RecordID. But I moved the RecordID type out of the waiter.
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.
This still says RequestID. Have I missed something?
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.
It used to be called ID and was on the type Waiter, but dependent on the HTTPScheduledRequest
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.
I see, I was confused by this comment saying the change was to RecordID.
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.
| } | ||
| var request: HTTPScheduledRequest{ | ||
| didSet{ |
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.
Might it be easier to make eventLoopRequirement a computed property?
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.
Since HTTPScheduledRequest is a protocol, I wanted to keep the number of calls going through the lookup table as small as possible.
Motivation
For the new
HTTPConnectionPool.StateMachinewe need a newWaitertype.Modifications
HTTPConnectionPool.Waiter