From d58e47cbbefe8c63d532ffc8e9871a17d02ed248 Mon Sep 17 00:00:00 2001 From: trisua Date: Sun, 20 Jul 2025 03:33:03 -0400 Subject: [PATCH] fix: only add delta bytes when changing app data value --- crates/app/src/routes/api/v1/app_data.rs | 9 ++++++++- crates/core/src/database/app_data.rs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/app/src/routes/api/v1/app_data.rs b/crates/app/src/routes/api/v1/app_data.rs index d5e8c3f..5e0182e 100644 --- a/crates/app/src/routes/api/v1/app_data.rs +++ b/crates/app/src/routes/api/v1/app_data.rs @@ -160,7 +160,14 @@ pub async fn update_value_request( } // ... - if let Err(e) = data.add_app_data_used(app.id, req.value.len() as i32).await { + // we only need to add the delta size (the next size - the old size) + if let Err(e) = data + .add_app_data_used( + app.id, + (req.value.len() as i32) - (app_data.value.len() as i32), + ) + .await + { return Json(e.into()); } diff --git a/crates/core/src/database/app_data.rs b/crates/core/src/database/app_data.rs index 2b8520c..9aeafc1 100644 --- a/crates/core/src/database/app_data.rs +++ b/crates/core/src/database/app_data.rs @@ -5,7 +5,7 @@ use crate::{auto_method, DataManager}; use oiseau::{PostgresRow, execute, get, query_row, query_rows, params}; pub const FREE_DATA_LIMIT: usize = 512_000; -pub const PASS_DATA_LIMIT: usize = 5_242_880; +pub const PASS_DATA_LIMIT: usize = 26_214_400; impl DataManager { /// Get a [`AppData`] from an SQL row.