perf: findings 6.1, 6.2, 2.6 — async Argon2, moka cache, full streaming migration
- 6.1: PasswordHasherPort now async_trait with spawn_blocking for Argon2
- 6.2: OIDC pending maps migrated from std::sync::Mutex to moka::sync::Cache with TTL
- 2.6: All file download paths migrated to 64KB streaming (get_file_stream / read_blob_stream)
- WOPI, dedup, batch ZIP, file_retrieval_service consumers migrated
- WebDAV COPY uses zero-copy dedup (copy_file)
- Removed dead code: get_file_content, get_file_mmap, read_blob, read_blob_bytes
from traits, impls, stubs, and mocks (18 files touched)
This commit is contained in:
@@ -117,6 +117,9 @@ async fn check_file_info(
|
||||
}
|
||||
|
||||
/// GET /wopi/files/{file_id}/contents — GetFile
|
||||
///
|
||||
/// Streams the file content to Collabora/OnlyOffice in 64 KB chunks.
|
||||
/// Memory usage is constant (~64 KB) regardless of file size.
|
||||
async fn get_file(
|
||||
Path(file_id): Path<String>,
|
||||
Query(token_query): Query<WopiTokenQuery>,
|
||||
@@ -138,10 +141,13 @@ async fn get_file(
|
||||
.app_state
|
||||
.applications
|
||||
.file_retrieval_service
|
||||
.get_file_content(&file_id)
|
||||
.get_file_stream(&file_id)
|
||||
.await
|
||||
{
|
||||
Ok(content) => (StatusCode::OK, content).into_response(),
|
||||
Ok(stream) => {
|
||||
let body = axum::body::Body::from_stream(std::pin::Pin::from(stream));
|
||||
(StatusCode::OK, body).into_response()
|
||||
}
|
||||
Err(_) => StatusCode::NOT_FOUND.into_response(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user