From 5a8df0b1e875aceae4971057127a36062453fd20 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Sat, 14 Jan 2023 23:55:10 -0700 Subject: [PATCH] server/upload_path: Refactor --- server/src/api/v1/upload_path.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/api/v1/upload_path.rs b/server/src/api/v1/upload_path.rs index 73dfecb..ac284bd 100644 --- a/server/src/api/v1/upload_path.rs +++ b/server/src/api/v1/upload_path.rs @@ -161,6 +161,10 @@ async fn upload_path_dedup( } } + let file_size = existing_nar.file_size + .map(|dbs| dbs.try_into().map_err(ServerError::database_error)) + .transpose()?; + // Finally... let txn = database .begin() @@ -188,10 +192,6 @@ async fn upload_path_dedup( txn.commit().await.map_err(ServerError::database_error)?; - let file_size = existing_nar.file_size - .map(|dbs| dbs.try_into().map_err(ServerError::database_error)) - .transpose()?; - // Ensure it's not unlocked earlier drop(existing_nar);