Skip to content

Commit

Permalink
(fix) Enable logging; fix large videos on slow connection (#10)
Browse files Browse the repository at this point in the history
When uploading large videos to the s3 bucket (~200mb) on a slow uplink
(2 Mb/s) a stall protection for upload kick in.

This protection incorrectly detects stalled upload and panics, even on
active uploads healthy uploads.

See awslabs/aws-sdk-rust#1146

Crate changes:

- add log and env_logger to aid debugging and root causing
- update aws-sdk to latest

Testing:

RUST_LOG=debug cargo run -- -i "~/Downloads/meeting.mp4" -o text

Co-authored-by: kolupaev <[email protected]>
  • Loading branch information
kolupaev and kolupaev authored Sep 3, 2024
1 parent 3c0c803 commit 294c94b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ license = "Apache-2.0"
include = ["src/**/*", "config.toml"]

[dependencies]
log = "0.4.22"
env_logger = "0.11.5"
anyhow = "1.0.82"
aws-config = { version = "1.1.7", features = ["behavior-version-latest" ] }
aws-sdk-bedrockruntime = "1.23.0"
aws-sdk-s3 = "1.24.0"
aws-sdk-transcribe = "1.21.0"
aws-config = { version = "1.5.5", features = ["behavior-version-latest" ] }
aws-sdk-bedrockruntime = "1.44.0"
aws-sdk-s3 = "1.44.0"
aws-sdk-transcribe = "1.39.0"
aws-types = "0.14.0"
clap = { version = "4.5.4", features = ["derive"] }
config = "0.13.3"
Expand Down
10 changes: 10 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::path::Path;
use anyhow::{bail, Context, Result};
use aws_config::meta::region::RegionProviderChain;
use aws_config::{Region, SdkConfig};
use aws_sdk_s3::config::StalledStreamProtectionConfig;
use clap::Parser;
use config::{Config, File as ConfigFile};
use docx_rs::{Docx, Paragraph, Run};
Expand Down Expand Up @@ -55,6 +56,7 @@ enum OutputType {

#[::tokio::main]
async fn main() -> Result<()> {
env_logger::init();
let config = load_config(None).await;

let settings = Config::builder()
Expand Down Expand Up @@ -311,6 +313,14 @@ async fn load_config(region: Option<Region>) -> SdkConfig {
config = config.region(RegionProviderChain::default_provider().or_else("us-east-1"))
}
}

// Resolves issues with uploading large S3 files
// See https://github.com/awslabs/aws-sdk-rust/issues/1146
config = config
.stalled_stream_protection(
StalledStreamProtectionConfig::disabled()
);

config.load().await
}

Expand Down

0 comments on commit 294c94b

Please sign in to comment.