diff --git a/crates/pinakes-server/src/routes/media.rs b/crates/pinakes-server/src/routes/media.rs index 9c652ac..5570310 100644 --- a/crates/pinakes-server/src/routes/media.rs +++ b/crates/pinakes-server/src/routes/media.rs @@ -862,7 +862,9 @@ pub async fn rename_media( changed_by_device: None, timestamp: chrono::Utc::now(), }; - let _ = state.storage.record_sync_change(&change).await; + if let Err(e) = state.storage.record_sync_change(&change).await { + tracing::warn!(error = %e, "failed to record sync change"); + } // Record audit pinakes_core::audit::record_action( @@ -902,7 +904,9 @@ pub async fn move_media_endpoint( changed_by_device: None, timestamp: chrono::Utc::now(), }; - let _ = state.storage.record_sync_change(&change).await; + if let Err(e) = state.storage.record_sync_change(&change).await { + tracing::warn!(error = %e, "failed to record sync change"); + } // Record audit pinakes_core::audit::record_action( @@ -958,7 +962,9 @@ pub async fn batch_move_media( changed_by_device: None, timestamp: chrono::Utc::now(), }; - let _ = state.storage.record_sync_change(&change).await; + if let Err(e) = state.storage.record_sync_change(&change).await { + tracing::warn!(error = %e, "failed to record sync change"); + } } } @@ -1001,7 +1007,9 @@ pub async fn soft_delete_media( changed_by_device: None, timestamp: chrono::Utc::now(), }; - let _ = state.storage.record_sync_change(&change).await; + if let Err(e) = state.storage.record_sync_change(&change).await { + tracing::warn!(error = %e, "failed to record sync change"); + } // Record audit pinakes_core::audit::record_action( @@ -1040,7 +1048,9 @@ pub async fn restore_media( changed_by_device: None, timestamp: chrono::Utc::now(), }; - let _ = state.storage.record_sync_change(&change).await; + if let Err(e) = state.storage.record_sync_change(&change).await { + tracing::warn!(error = %e, "failed to record sync change"); + } // Record audit pinakes_core::audit::record_action( @@ -1139,7 +1149,9 @@ pub async fn permanent_delete_media( changed_by_device: None, timestamp: chrono::Utc::now(), }; - let _ = state.storage.record_sync_change(&change).await; + if let Err(e) = state.storage.record_sync_change(&change).await { + tracing::warn!(error = %e, "failed to record sync change"); + } // Clean up thumbnail if let Some(ref thumb_path) = item.thumbnail_path diff --git a/crates/pinakes-server/src/routes/shares.rs b/crates/pinakes-server/src/routes/shares.rs index ded0160..c6236c6 100644 --- a/crates/pinakes-server/src/routes/shares.rs +++ b/crates/pinakes-server/src/routes/shares.rs @@ -171,8 +171,10 @@ pub async fn create_share( created_at: Utc::now(), }; - // Ignore notification errors - let _ = state.storage.create_share_notification(¬ification).await; + if let Err(e) = state.storage.create_share_notification(¬ification).await + { + tracing::warn!(error = %e, "failed to send share notification"); + } } Ok(Json(created.into())) @@ -188,7 +190,7 @@ pub async fn list_outgoing( let user_id = resolve_user_id(&state.storage, &username).await?; let pagination = Pagination { offset: params.offset.unwrap_or(0), - limit: params.limit.unwrap_or(50), + limit: params.limit.unwrap_or(50).min(1000), sort: params.sort, }; @@ -211,7 +213,7 @@ pub async fn list_incoming( let user_id = resolve_user_id(&state.storage, &username).await?; let pagination = Pagination { offset: params.offset.unwrap_or(0), - limit: params.limit.unwrap_or(50), + limit: params.limit.unwrap_or(50).min(1000), sort: params.sort, }; @@ -316,7 +318,10 @@ pub async fn update_share( is_read: false, created_at: Utc::now(), }; - let _ = state.storage.create_share_notification(¬ification).await; + if let Err(e) = state.storage.create_share_notification(¬ification).await + { + tracing::warn!(error = %e, "failed to send share update notification"); + } } Ok(Json(updated.into())) @@ -351,7 +356,10 @@ pub async fn delete_share( is_read: false, created_at: Utc::now(), }; - let _ = state.storage.create_share_notification(¬ification).await; + if let Err(e) = state.storage.create_share_notification(¬ification).await + { + tracing::warn!(error = %e, "failed to send share revocation notification"); + } } state.storage.delete_share(ShareId(id)).await.map_err(|e| { @@ -442,7 +450,9 @@ pub async fn access_shared( details: None, timestamp: Utc::now(), }; - let _ = state.storage.record_share_activity(&activity).await; + if let Err(e) = state.storage.record_share_activity(&activity).await { + tracing::warn!(error = %e, "failed to record share activity"); + } return Err(ApiError::unauthorized("Invalid password")); } @@ -511,7 +521,7 @@ pub async fn get_activity( let pagination = Pagination { offset: params.offset.unwrap_or(0), - limit: params.limit.unwrap_or(50), + limit: params.limit.unwrap_or(50).min(1000), sort: params.sort, }; diff --git a/crates/pinakes-server/src/routes/sync.rs b/crates/pinakes-server/src/routes/sync.rs index e824219..802563a 100644 --- a/crates/pinakes-server/src/routes/sync.rs +++ b/crates/pinakes-server/src/routes/sync.rs @@ -266,7 +266,7 @@ pub async fn get_changes( drop(config); let cursor = params.cursor.unwrap_or(0); - let limit = params.limit.unwrap_or(DEFAULT_CHANGES_LIMIT); + let limit = params.limit.unwrap_or(DEFAULT_CHANGES_LIMIT).min(1000); let changes = state .storage