feat(labrinth): Redis Cluster (#6771)

* chore(labrinth): bump to redis 1.4.1

* feat(labrinth): redis cluster

* chore: cleanup

* feat(labrinth): cache locking

* fix(labrinth): clippy

* chore(labrinth): cleanup env, remove postcard support

* chore(ci): fix test env for labrinth

* chore(labrinth): bump all key versions

* chore(labrinth): improve redis key identities handling

* chore(labrinth): simplify deadline handling

* chore(labrinth): remove unused lease tracking

* chore(labrinth): remove distributed cache locking for now

* chore(labrinth): improve redis backend init error

* feat(labrinth): expose redis read replica strategy

* chore(ci): remove other connection mode tests

* chore: split xredis crate

* feat(xredis): primaries routing

* chore: tombi fmt

* chore: clippy

* chore: update query cache
This commit is contained in:
François-Xavier Talbot
2026-07-23 11:35:02 +02:00
committed by GitHub
parent 11af2651ef
commit b4d681e713
146 changed files with 4741 additions and 2000 deletions
@@ -10,7 +10,6 @@ use serde_json::{Value, json};
use tracing::{info, warn};
use crate::database::PgPool;
use crate::database::redis::RedisPool;
use crate::env::ENV;
use crate::models::ids::{ProjectId, VersionId};
use crate::routes::ApiError;
@@ -24,6 +23,7 @@ use crate::search::{
SearchResults, TasksCancelFilter, UploadSearchProject,
};
use crate::util::error::Context;
use xredis::RedisPool;
#[derive(Debug, Clone)]
pub struct TypesenseConfig {
@@ -8,9 +8,10 @@ use rdkafka::{
};
use serde::Deserialize;
use std::collections::HashSet;
use xredis::RedisPool;
use crate::{
database::{PgPool, redis::RedisPool},
database::PgPool,
models::ids::ProjectId,
search::{
SearchBackend, incremental::SEARCH_PROJECT_INDEX_QUEUE_TOPIC,
+1 -1
View File
@@ -18,7 +18,6 @@ use crate::database::models::{
DBOrganizationId, DBProjectId, DBUserId, DBVersionId, LoaderFieldEnumId,
LoaderFieldEnumValueId, LoaderFieldId,
};
use crate::database::redis::RedisPool;
use crate::models::exp;
use crate::models::ids::ProjectId;
use crate::models::projects::{DependencyType, from_duplicate_version_fields};
@@ -26,6 +25,7 @@ use crate::models::v2::projects::LegacyProject;
use crate::routes::v2_reroute;
use crate::search::{SearchProjectDependency, UploadSearchProject};
use crate::util::error::Context;
use xredis::RedisPool;
struct PartialProject {
id: DBProjectId,
+10 -8
View File
@@ -1,4 +1,3 @@
use crate::database::redis::RedisPool;
use crate::models::exp;
use crate::models::exp::minecraft::JavaServerPing;
use crate::models::ids::{ProjectId, VersionId};
@@ -14,6 +13,7 @@ use serde_json::Value;
use std::{collections::HashMap, str::FromStr, sync::Arc};
use thiserror::Error;
use utoipa::ToSchema;
use xredis::RedisPool;
pub mod backend;
pub mod incremental;
@@ -150,14 +150,16 @@ async fn hydrate_search_results(
HashMap::new()
} else {
let mut redis = redis_pool.connect().await?;
let ping_keys = project_ids
.iter()
.map(|project_id| {
redis_pool
.key()
.entity(server_ping::REDIS_NAMESPACE, project_id)
})
.collect::<Vec<_>>();
let ping_results = redis
.get_many_deserialized::<JavaServerPing>(
server_ping::REDIS_NAMESPACE,
&project_ids
.iter()
.map(ToString::to_string)
.collect::<Vec<_>>(),
)
.get_many_deserialized::<JavaServerPing>(&ping_keys)
.await?;
ping_results