From ec582ad68f43f5584a1fc5c664916b26552167d0 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Tue, 11 Mar 2025 14:42:13 +0100 Subject: [PATCH] Increase the number of request/s for sign_in/sign_up --- backend/src/consts.rs | 4 ++-- backend/src/hash.rs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/src/consts.rs b/backend/src/consts.rs index 7fdbb4e..5b65489 100644 --- a/backend/src/consts.rs +++ b/backend/src/consts.rs @@ -18,8 +18,8 @@ pub const TOKEN_SIZE: usize = 32; pub const SEND_EMAIL_TIMEOUT: Duration = Duration::from_secs(60); -pub const NUMBER_OF_CONCURRENT_HTTP_REQUEST_FOR_RATE_LIMIT: u64 = 20; -pub const DURATION_FOR_RATE_LIMIT: Duration = Duration::from_secs(5); +pub const NUMBER_OF_CONCURRENT_HTTP_REQUEST_FOR_RATE_LIMIT: u64 = 10; +pub const DURATION_FOR_RATE_LIMIT: Duration = Duration::from_secs(2); // HTTP headers, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers. // Common headers can be found in 'axum::http::header' (which is a re-export of the create 'http'). diff --git a/backend/src/hash.rs b/backend/src/hash.rs index cb70199..c2626ad 100644 --- a/backend/src/hash.rs +++ b/backend/src/hash.rs @@ -6,6 +6,8 @@ use argon2::{ }; fn get_argon2<'k>() -> Argon2<'k> { + // Note: It's not neccessary to have only one Argon2 object, creating a new one + // when we need it is lightweight. Argon2::new( argon2::Algorithm::Argon2id, argon2::Version::V0x13, -- 2.49.0