mirror of
https://github.com/modrinth/code.git
synced 2026-08-24 16:44:51 +00:00
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:
@@ -2,12 +2,10 @@ use eyre::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use validator::Validate;
|
||||
use xredis::RedisPool;
|
||||
|
||||
use crate::{
|
||||
database::{
|
||||
models::{DBProjectId, DBVersionId},
|
||||
redis::RedisPool,
|
||||
},
|
||||
database::models::{DBProjectId, DBVersionId},
|
||||
models::{
|
||||
exp::{
|
||||
component::{
|
||||
@@ -257,14 +255,14 @@ pub async fn fetch_query_context(
|
||||
{
|
||||
HashMap::new()
|
||||
} else {
|
||||
let ping_keys = minecraft_java_server_pings
|
||||
.iter()
|
||||
.map(|project_id| {
|
||||
redis.key().entity(server_ping::REDIS_NAMESPACE, project_id)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
redis
|
||||
.get_many_deserialized::<minecraft::JavaServerPing>(
|
||||
server_ping::REDIS_NAMESPACE,
|
||||
&minecraft_java_server_pings
|
||||
.iter()
|
||||
.map(ToString::to_string)
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
.get_many_deserialized::<minecraft::JavaServerPing>(&ping_keys)
|
||||
.await?
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
@@ -280,14 +278,14 @@ pub async fn fetch_query_context(
|
||||
let minecraft_server_analytics = if minecraft_server_analytics.is_empty() {
|
||||
HashMap::new()
|
||||
} else {
|
||||
let analytics_keys = minecraft_server_analytics
|
||||
.iter()
|
||||
.map(|project_id| {
|
||||
redis.key().entity(MINECRAFT_SERVER_ANALYTICS, project_id)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
redis
|
||||
.get_many_deserialized::<MinecraftServerAnalytics>(
|
||||
MINECRAFT_SERVER_ANALYTICS,
|
||||
&minecraft_server_analytics
|
||||
.iter()
|
||||
.map(ToString::to_string)
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
.get_many_deserialized::<MinecraftServerAnalytics>(&analytics_keys)
|
||||
.await?
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
|
||||
Reference in New Issue
Block a user