diff options
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/atuin-common/src/api.rs | 1 | ||||
| -rw-r--r-- | crates/atuin-server-database/src/lib.rs | 1 | ||||
| -rw-r--r-- | crates/atuin-server-postgres/src/lib.rs | 15 | ||||
| -rw-r--r-- | crates/atuin-server-sqlite/src/lib.rs | 11 | ||||
| -rw-r--r-- | crates/atuin-server/src/handlers/mod.rs | 5 |
5 files changed, 0 insertions, 33 deletions
diff --git a/crates/atuin-common/src/api.rs b/crates/atuin-common/src/api.rs index 4e897811..1aaf9859 100644 --- a/crates/atuin-common/src/api.rs +++ b/crates/atuin-common/src/api.rs @@ -106,7 +106,6 @@ pub struct ErrorResponse<'a> { pub struct IndexResponse { pub homage: String, pub version: String, - pub total_history: i64, } #[derive(Debug, Serialize, Deserialize)] diff --git a/crates/atuin-server-database/src/lib.rs b/crates/atuin-server-database/src/lib.rs index db170b50..a4ddf23c 100644 --- a/crates/atuin-server-database/src/lib.rs +++ b/crates/atuin-server-database/src/lib.rs @@ -113,7 +113,6 @@ pub trait Database: Sized + Clone + Send + Sync + 'static { async fn update_user_password(&self, u: &User) -> DbResult<()>; - async fn total_history(&self) -> DbResult<i64>; async fn count_history(&self, user: &User) -> DbResult<i64>; async fn count_history_cached(&self, user: &User) -> DbResult<i64>; diff --git a/crates/atuin-server-postgres/src/lib.rs b/crates/atuin-server-postgres/src/lib.rs index 8c40e6cc..54ba2ee8 100644 --- a/crates/atuin-server-postgres/src/lib.rs +++ b/crates/atuin-server-postgres/src/lib.rs @@ -245,21 +245,6 @@ impl Database for Postgres { } #[instrument(skip_all)] - async fn total_history(&self) -> DbResult<i64> { - // The cache is new, and the user might not yet have a cache value. - // They will have one as soon as they post up some new history, but handle that - // edge case. - - let res: (i64,) = sqlx::query_as("select sum(total) from total_history_count_user") - .fetch_optional(self.read_pool()) - .await - .map_err(fix_error)? - .unwrap_or((0,)); - - Ok(res.0) - } - - #[instrument(skip_all)] async fn count_history_cached(&self, user: &User) -> DbResult<i64> { let res: (i32,) = sqlx::query_as( "select total from total_history_count_user diff --git a/crates/atuin-server-sqlite/src/lib.rs b/crates/atuin-server-sqlite/src/lib.rs index 9cc1e8a7..83d05ea5 100644 --- a/crates/atuin-server-sqlite/src/lib.rs +++ b/crates/atuin-server-sqlite/src/lib.rs @@ -232,17 +232,6 @@ impl Database for Sqlite { } #[instrument(skip_all)] - async fn total_history(&self) -> DbResult<i64> { - let res: (i64,) = sqlx::query_as("select count(1) from history") - .fetch_optional(&self.pool) - .await - .map_err(fix_error)? - .unwrap_or((0,)); - - Ok(res.0) - } - - #[instrument(skip_all)] async fn count_history(&self, user: &User) -> DbResult<i64> { // The cache is new, and the user might not yet have a cache value. // They will have one as soon as they post up some new history, but handle that diff --git a/crates/atuin-server/src/handlers/mod.rs b/crates/atuin-server/src/handlers/mod.rs index 1b9fd162..2176ac5e 100644 --- a/crates/atuin-server/src/handlers/mod.rs +++ b/crates/atuin-server/src/handlers/mod.rs @@ -16,10 +16,6 @@ const VERSION: &str = env!("CARGO_PKG_VERSION"); pub async fn index<DB: Database>(state: State<AppState<DB>>) -> Json<IndexResponse> { let homage = r#""Through the fathomless deeps of space swims the star turtle Great A'Tuin, bearing on its back the four giant elephants who carry on their shoulders the mass of the Discworld." -- Sir Terry Pratchett"#; - // Error with a -1 response - // It's super unlikely this will happen - let count = state.database.total_history().await.unwrap_or(-1); - let version = state .settings .fake_version @@ -28,7 +24,6 @@ pub async fn index<DB: Database>(state: State<AppState<DB>>) -> Json<IndexRespon Json(IndexResponse { homage: homage.to_string(), - total_history: count, version, }) } |
