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

Fix documentation for timeout parameters #535

Merged
merged 3 commits into from
Mar 27, 2017
Merged

Fix documentation for timeout parameters #535

merged 3 commits into from
Mar 27, 2017

Conversation

pschultz
Copy link
Contributor

@pschultz pschultz commented Dec 27, 2016

Description

The description for the "timeout" parameter is misleading. The parameter has nothing to do idle timeouts, which is implied by linking to the documentation for "wait_timeout". It's only use is in the net.Dial call and it is documented as such in the config struct

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary
  • Added myself / the copyright holder to the AUTHORS file

Copy link
Member

@methane methane left a comment

Choose a reason for hiding this comment

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

I think connect_timeout is better name for MySQL client compatibility.
http://dev.mysql.com/doc/refman/5.7/en/mysql-command-options.html#option_mysql_connect_timeout

README.md Outdated
Default: 0
```

I/O read timeout. The value must be a decimal number with an unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*.
I/O read timeout. The value must be a decimal number with a unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*.
Copy link
Member

Choose a reason for hiding this comment

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

Is this correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, because "unit" does not start with a vowel, phonetically: /ˈjuː.nɪt/.

@pschultz
Copy link
Contributor Author

connect_timeout may be a better name, but I really don't want to change the API here. This is just a clarification in the README.

@pschultz
Copy link
Contributor Author

Anything else you need me to do here?

README.md Outdated
Default: OS default
```

*Driver* side connection timeout. The value must be a decimal number with an unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*. To set a server side timeout, use the parameter [`wait_timeout`](http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_wait_timeout).
Timeout for establishing connections, aka dial timeout. The value must be a decimal number with a unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*. To configure the duration after which connections are removed from the connection pool, use [*sql.DB.SetConnMaxLifetime](https://golang.org/pkg/database/sql/#DB.SetConnMaxLifetime).
Copy link
Member

Choose a reason for hiding this comment

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

I think second sentence ("To configure...") is redundant.
Both of wait_timeout sysvar and SetConnMaxLifetime are totally unrelated to this config variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That SetConnMaxLifetime is unrelated to the driver config is exactly what makes this link useful. It says "the driver doesn't do what you may be looking for; see here instead."

What's the harm in this link? The Internet works so well because of hyperlinks.

If you insist I'll remove it, but in my opinion it is perfectly adequate to mention SetConnMaxLifetime in the documentation for a parameter that is simply called "timeout", which by itself can mean a dozen different things.

Copy link
Member

Choose a reason for hiding this comment

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

If there are 1000 people, there may be 1000 "may be looking for".
Adding 1000 links for each option makes README unreadable.

So my question is why your case is so special?

Copy link
Member

Choose a reason for hiding this comment

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

If this is really FAQ, I'm OK to adding link. But I have seen only one question. (#488)

I think SetConnMaxLifetime is very useful (that's why I added it!), I feel there should be more appreciate section like "recommended configurations".

Copy link
Member

Choose a reason for hiding this comment

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

Maybe, adding "Configuring connection pool and timeout" section under the "Usage" section is more useufl.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough. Done in 4416483.

@julienschmidt
Copy link
Member

Just as a side-note: We can't merge anything without attributing the copyright to someone

@pschultz
Copy link
Contributor Author

As in git commit --signoff?

@julienschmidt
Copy link
Member

As in an entry in the AUTHORS file

@julienschmidt julienschmidt added this to the v1.4 milestone Mar 27, 2017
@pschultz
Copy link
Contributor Author

I've added myself to AUTHORS.

@julienschmidt
Copy link
Member

julienschmidt commented Mar 27, 2017

Please push the change to your branch. It can be merged then.

@pschultz
Copy link
Contributor Author

Commited to the wrong branch by accident. It's here now.

@julienschmidt julienschmidt merged commit 9dee4ca into go-sql-driver:master Mar 27, 2017
@pschultz pschultz deleted the patch-1 branch March 27, 2017 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants