Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions app/src/storage/blobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,19 @@ impl BlobStore {
let url = self.bucket.create_bucket(&self.credentials).sign(URL_TTL);
let response = self.http.put(url).send().await.map_err(|e| error(e.to_string()))?;
let status = response.status();
if status.is_success() || status.as_u16() == 409 {
Ok(())
} else {
Err(error(format!("creating bucket: HTTP {status}")))
if !(status.is_success() || status.as_u16() == 409) {
return Err(error(format!("creating bucket: HTTP {status}")));
}
// A 409 can come while another caller is still creating the bucket (tests in one binary all start by making
// it), and an upload straight after then gets NoSuchBucket: wait until the bucket answers.
for _ in 0..100 {
let url = self.bucket.head_bucket(Some(&self.credentials)).sign(URL_TTL);
if self.http.head(url).send().await.is_ok_and(|r| r.status().is_success()) {
return Ok(());
}
tokio::time::sleep(Duration::from_millis(100)).await;
}
Err(error("the bucket still isn't there 10 s after creating it"))
}

/// The application's store (`S3_*`): one per application, from the container, so its HTTP connections belong to
Expand Down
Loading