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

is it possible adding a mysql_option timeout ? #13

Closed
TheSnowFox opened this issue Oct 17, 2017 · 4 comments
Closed

is it possible adding a mysql_option timeout ? #13

TheSnowFox opened this issue Oct 17, 2017 · 4 comments

Comments

@TheSnowFox
Copy link
Contributor

Hi,
First of all, thank you very much for this module and SwiftKuery, you've done an great job.
I'm using your modules for my current project and it works great except for one thing:
At the first connection, if mysql server is down or if settings are wrong (host address, password, etc.) in:
MySQLThreadSafeConnection.createPool(host: , user: , password: , database: , port: , unixSocket: , clientFlag: , characterSet:, reconnect:, poolOptions: ) ,
the execution is blocked at:
if mysql_real_connect(mysql, host, user, password, database, port, unixSocket, clientFlag) != nil in connect() (line 166 in MySQLConnection.swift)
The program doesn't crash but seems waiting.

I can be wrong but by reading the source files, it seems that mysql_options(MYSQL_OPT_CONNECT_TIMEOUT) was never set.
Is it possible to add a way to set this property or using timeout argument in ConnectionPoolOption(initialCapacity:, maxCapacity:, timeout:) ?

Thank you in advance

@ianpartridge
Copy link

That sounds like a good enhancement and we would definitely welcome a PR to improve this.

@TheSnowFox
Copy link
Contributor Author

Sorry for my latency, I thought I would receive a notification by mail...
I'm new to gitHub, and not a professional developper (this is not my main activity...)
PR stands for pull request ?

I forked the repository and modify the file, pushed to the new fork. Tell me if you want me to try a pull request... I don't exactly know the procedure and how to tag version... (it has changed from 0.13.2 to 1.0.0 ?)

@ianpartridge
Copy link

Yes, PR is Pull Request. I took a look at your fork commit at TheSnowFox@da372d5 it looks ready for review.

You should be able to open the PR by going to https://github.com/TheSnowFox/SwiftKueryMySQL and clicking the "New Pull Request" button.

@TheSnowFox
Copy link
Contributor Author

Thank you :)
I've just tried

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants