Skip to content

Instantly share code, notes, and snippets.

@trimoq
Last active March 25, 2020 10:02
Show Gist options
  • Save trimoq/f27e0d24962cc2c6c5810e0ba193cf66 to your computer and use it in GitHub Desktop.
Save trimoq/f27e0d24962cc2c6c5810e0ba193cf66 to your computer and use it in GitHub Desktop.
The slightly simplified process function
pub async fn process(request: DownloadTask, cfg: ConverterConfig) -> Result<...>{
let bytes = download_url(request.url).await?;
let (image, thumbnail) = tokio::task::spawn_blocking(|| process_image(bytes)).await?;
push_to_s3(image, cfg, request.target_path).await?;
push_to_s3(thumbnail, cfg, request.thumbnail_path).await?;
info!("Finished download for {}",request.correlation_id);
Ok(())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment