Skip to content

Commit

Permalink
Merge pull request #333 from sohosai/feature/fix-file-upload
Browse files Browse the repository at this point in the history
ファイルアップロード時のエラーに対するワークラウンドを実装した
  • Loading branch information
arata-nvm authored Aug 23, 2024
2 parents 74197ef + 78017c7 commit ce702e4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions crates/sos24-infrastructure/src/shared/s3.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::ops::Deref;
use std::{ops::Deref, time::Duration};

use aws_sdk_s3::{
config::{Builder, Credentials, Region},
config::{timeout::TimeoutConfig, Builder, Credentials, Region, StalledStreamProtectionConfig},
Client,
};

Expand Down Expand Up @@ -29,6 +29,18 @@ impl S3 {
.region(Region::new(region.to_string()))
.credentials_provider(credential)
.behavior_version_latest()
.timeout_config(
TimeoutConfig::builder()
.operation_attempt_timeout(Duration::from_secs(60 * 10))
.build(),
)
// ファイルアップロード時に以下のエラーが出る問題のワークラウンド
// "minimum throughput was specified at 1 B/s, but throughput of 0 B/s was observed"
.stalled_stream_protection(
StalledStreamProtectionConfig::enabled()
.upload_enabled(false)
.build(),
)
.build();

tracing::info!("S3 client initialized");
Expand Down

0 comments on commit ce702e4

Please sign in to comment.