-
Notifications
You must be signed in to change notification settings - Fork 495
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
Update database connections defaults #5853
base: main
Are you sure you want to change the base?
Update database connections defaults #5853
Conversation
Signed-off-by: jananiarunachalam <[email protected]>
b0a5681
to
9b46080
Compare
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.
Thank you @jananiarunachalam for working on this contribution!
defaultConnMaxLifetime, err := time.ParseDuration("30s") | ||
db.DB().SetConnMaxLifetime(defaultConnMaxLifetime) // default value | ||
if err != nil { | ||
return nil, "", false, nil, fmt.Errorf("failed to parse conn_max_lifetime %q: %w", defaultConnMaxLifetime, err) | ||
} |
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.
The SetConnMaxLifetime function is already called later, based on the ConnMaxLifetime setting.
We don't need to make any change there. What we need to adjust is the ConnMaxIdleTime property calling SetConnMaxIdleTime, maybe with a value of 30s.
Also note that you will not need to make any parsing for that (i.e. time.ParseDuration("30s")
), you can just call SetConnMaxIdleTime(time.Second * 30
). We may define this as a constant in the function, and probably the MaxOpenConns and MaxIdleConns numbers too.
Also, could you update the documentation in https://github.com/spiffe/spire/blob/main/doc/plugin_server_datastore_sql.md with the new defaults? |
Pull Request check list
Affected functionality
Description of change
Which issue this PR fixes
Fixes #5802