Skip to content

Commit

Permalink
chore: add sqlx max connection timeout jitter
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFlurry committed Jun 15, 2024
1 parent 3193de8 commit ff3edb6
Show file tree
Hide file tree
Showing 181 changed files with 755 additions and 371 deletions.
13 changes: 12 additions & 1 deletion lib/chirp-workflow/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,23 @@ rivet-runtime = { path = "../../runtime" }
rivet-util = { path = "../../util/core" }
serde = { version = "1.0.198", features = ["derive"] }
serde_json = "1.0.116"
sqlx = { version = "0.7.4", features = ["runtime-tokio", "postgres", "uuid", "json", "ipnetwork"] }
thiserror = "1.0.59"
tokio = { version = "1.37.0", features = ["full"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
uuid = { version = "1.8.0", features = ["v4", "serde"] }

[dependencies.sqlx]
git = "https://github.com/rivet-gg/sqlx"
rev = "08d6e61aa0572e7ec557abbedb72cebb96e1ac5b"
default-features = false
features = [
"runtime-tokio",
"postgres",
"uuid",
"json",
"ipnetwork"
]

[dev-dependencies]
anyhow = "1.0.82"
3 changes: 2 additions & 1 deletion lib/pools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ governor = "0.6"
url = "2.5.0"

[dependencies.sqlx]
version = "0.7.1"
git = "https://github.com/rivet-gg/sqlx"
rev = "08d6e61aa0572e7ec557abbedb72cebb96e1ac5b"
default-features = false
features = [
"runtime-tokio",
Expand Down
1 change: 1 addition & 0 deletions lib/pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ async fn crdb_from_env(_client_name: String) -> Result<Option<CrdbPool>, Error>
//
// See max lifetime https://www.cockroachlabs.com/docs/stable/connection-pooling#set-the-maximum-lifetime-of-connections
.max_lifetime(Duration::from_secs(15 * 60))
.max_lifetime_jitter(Duration::from_secs(90))
// Remove connections after a while in order to reduce load
// on CRDB after bursts
.idle_timeout(Some(Duration::from_secs(3 * 60)))
Expand Down
Loading

0 comments on commit ff3edb6

Please sign in to comment.