Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Keepalive #393

Merged
merged 5 commits into from
Aug 27, 2020
Merged

Keepalive #393

merged 5 commits into from
Aug 27, 2020

Conversation

mikehelmick
Copy link
Contributor

@mikehelmick mikehelmick commented Aug 27, 2020

Proposed Changes

  • Add optional DB keepalive pings

Release Note

New environment variable.
* `DB_MAX_CONN_IDLE_TIME` a duration, when set will be passed to DB connection pool. Default value of `1m`

@google-cla google-cla bot added the cla: yes Auto: added by CLA bot when all committers have signed a CLA. label Aug 27, 2020
@mikehelmick mikehelmick linked an issue Aug 27, 2020 that may be closed by this pull request
pkg/database/config.go Outdated Show resolved Hide resolved
pkg/database/database.go Outdated Show resolved Hide resolved
@@ -130,6 +137,10 @@ func (db *Database) OpenWithCacher(ctx context.Context, cacher cache.Cacher) err
return fmt.Errorf("database gorm.Open: %w", err)
}

if c.MaxConnectionIdleTime > 0 {
Copy link
Member

Choose a reason for hiding this comment

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

I haven't done as much research here, but wouldn't SetConnMaxLifetime work better (and avoid all this overhead)?

db.DB().SetConnMaxLifetime(1*time.Minute)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

made that the default - we can start there and see if it helps

@mikehelmick
Copy link
Contributor Author

just idle closes at first

@sethvargo
Copy link
Member

/lgtm
/approve

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mikehelmick, sethvargo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [mikehelmick,sethvargo]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-robot google-oss-robot merged commit 3edafb7 into google:main Aug 27, 2020
@google google locked and limited conversation to collaborators Oct 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Auto: added by CLA bot when all committers have signed a CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

apiserver fails to lookup authorized app and requires restart
3 participants