Skip to main content

store_client_uploads

Function store_client_uploads 

Source
async fn store_client_uploads(
    conn: &mut PgConnection,
    exercise_id: Uuid,
    user_id: Uuid,
    payload: Multipart,
    file_store: &dyn FileStore,
    uploaded_paths: &mut Vec<ExerciseServiceUploadCleanup>,
    base_url: &str,
) -> Result<Vec<ExerciseServiceUpload>, ControllerError>
Expand description

Stores the multipart parts and binds them to the exercise and user, so that a failure to record the binding cannot leave uploads the reaper is unable to find.

The transaction opens only after the last byte has been streamed: the multipart body has no time limit, so opening it first would pin a pool connection idle in transaction for the whole upload.