mirror of
https://github.com/modrinth/code.git
synced 2026-08-27 18:14:49 +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,7 +2,6 @@ use crate::database;
|
||||
use crate::database::models::project_item::ProjectQueryResult;
|
||||
use crate::database::models::version_item::VersionQueryResult;
|
||||
use crate::database::models::{DBCollection, DBOrganization, DBTeamMember};
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::database::{DBProject, DBVersion, models};
|
||||
use crate::database::{PgPool, ReadOnlyPgPool};
|
||||
use crate::models::ids::FileId;
|
||||
@@ -14,6 +13,7 @@ use crate::queue::file_scan::get_files_missing_attribution;
|
||||
use crate::routes::ApiError;
|
||||
use futures::TryStreamExt;
|
||||
use itertools::Itertools;
|
||||
use xredis::RedisPool;
|
||||
|
||||
pub fn require_verified_email(user: &User) -> Result<(), ApiError> {
|
||||
if !user.email_verified.unwrap_or(false) {
|
||||
|
||||
@@ -59,6 +59,12 @@ pub enum AuthenticationError {
|
||||
Url,
|
||||
}
|
||||
|
||||
impl From<xredis::Error> for AuthenticationError {
|
||||
fn from(error: xredis::Error) -> Self {
|
||||
Self::Database(error.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl actix_web::ResponseError for AuthenticationError {
|
||||
fn status_code(&self) -> StatusCode {
|
||||
match self {
|
||||
|
||||
@@ -12,7 +12,6 @@ use crate::database::models::{
|
||||
DBOAuthClientAuthorizationId, generate_oauth_access_token_id,
|
||||
generate_oauth_client_authorization_id,
|
||||
};
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::models;
|
||||
use crate::models::ids::OAuthClientId;
|
||||
use crate::models::pats::Scopes;
|
||||
@@ -25,6 +24,7 @@ use rand::distributions::Alphanumeric;
|
||||
use rand::{Rng, SeedableRng};
|
||||
use rand_chacha::ChaCha20Rng;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use xredis::RedisPool;
|
||||
|
||||
use self::errors::{OAuthError, OAuthErrorType};
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use super::AuthProvider;
|
||||
use crate::auth::AuthenticationError;
|
||||
use crate::database::models::{DBUser, user_item};
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::env::ENV;
|
||||
use crate::models::pats::Scopes;
|
||||
use crate::models::users::User;
|
||||
@@ -10,6 +9,7 @@ use crate::routes::internal::session::get_session_metadata;
|
||||
use actix_web::HttpRequest;
|
||||
use actix_web::http::header::{AUTHORIZATION, HeaderValue};
|
||||
use chrono::Utc;
|
||||
use xredis::RedisPool;
|
||||
|
||||
pub async fn get_maybe_user_from_headers<'a, E>(
|
||||
req: &HttpRequest,
|
||||
|
||||
Reference in New Issue
Block a user