1
0

PG/RedisPool configuration/o11y improvements (#5032)

* Don't retain Redis connections while doing database queries

* Optional REDIS_WAIT_TIMEOUT_MS

* Attach more data to CacheTimeout errrors

* Fix locks_released

* Fmt

* Set default REDIS_WAIT_TIMEOUT_MS to 15s

* Fix lint

* Close Redis connections idle for > 5 minutes

* Exponential backoff on cache spin lock
This commit is contained in:
François-Xavier Talbot
2026-01-08 14:47:13 -05:00
committed by GitHub
parent ea17534f77
commit ff222aa168
13 changed files with 269 additions and 130 deletions

View File

@@ -299,17 +299,19 @@ impl DBUser {
{
use futures::stream::TryStreamExt;
let mut redis = redis.connect().await?;
{
let mut redis = redis.connect().await?;
let cached_projects = redis
.get_deserialized_from_json::<Vec<DBProjectId>>(
USERS_PROJECTS_NAMESPACE,
&user_id.0.to_string(),
)
.await?;
let cached_projects = redis
.get_deserialized_from_json::<Vec<DBProjectId>>(
USERS_PROJECTS_NAMESPACE,
&user_id.0.to_string(),
)
.await?;
if let Some(projects) = cached_projects {
return Ok(projects);
if let Some(projects) = cached_projects {
return Ok(projects);
}
}
let db_projects = sqlx::query!(
@@ -326,6 +328,8 @@ impl DBUser {
.try_collect::<Vec<DBProjectId>>()
.await?;
let mut redis = redis.connect().await?;
redis
.set_serialized_to_json(
USERS_PROJECTS_NAMESPACE,