Skip to content
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 connect context arg to Connection::connect() #82

Merged
merged 1 commit into from
Dec 30, 2018
Merged

Conversation

trowski
Copy link
Member

@trowski trowski commented Oct 16, 2018

Addresses #81.

@trowski trowski requested a review from kelunik October 16, 2018 15:05
@trowski
Copy link
Member Author

trowski commented Oct 16, 2018

@prolic @kelunik Please review.

@prolic
Copy link
Contributor

prolic commented Oct 16, 2018

Looks good to me. I didn't check for postgres, maybe it's the same problem there? Can you also add a test?

@@ -30,14 +29,6 @@ public function __construct(int $timeout = self::DEFAULT_TIMEOUT)
*/
public function connect(SqlConnectionConfig $config): Promise
{
if (!$config instanceof ConnectionConfig) {
throw new \TypeError(\sprintf("Must provide an instance of %s to MySQL connectors", ConnectionConfig::class));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't have been dropped I guess?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was a little overzealous with the delete key.

Copy link
Member

@kelunik kelunik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous way should have worked, too. If the cancellation doesn't cancel, then there's another bug.

@trowski
Copy link
Member Author

trowski commented Oct 16, 2018

@kelunik As far as I can tell the previous way worked too (edit: nope, cancellation isn't checked until the socket timeout expires), though this way is better since a timeout >10 sec would have been overridden by the socket context.

@prolic I don't think this is a problem in postgres since that library uses loop watchers for connection due to how the extensions work.

@bwoebi
Copy link
Member

bwoebi commented Oct 29, 2018

Shouldn't TimeoutConnector gain that new context arg as well?

@trowski
Copy link
Member Author

trowski commented Oct 29, 2018

Potentially, but I think it would be better to add another class such as SocketContextConnector and keep TimeoutConnector simple.

@kelunik
Copy link
Member

kelunik commented Dec 29, 2018

Any reason why this has not been merged?

@trowski trowski merged commit e4b65f0 into master Dec 30, 2018
@trowski trowski deleted the issue-81 branch October 9, 2019 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants