Update dependencies, reduce timeouts
This commit is contained in:
parent
377b894460
commit
99cbe6337e
2 changed files with 19 additions and 14 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -758,7 +758,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "multipart-client-stream"
|
name = "multipart-client-stream"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.asonix.dog/asonix/multipart-client-stream#5bb45e9e82c457dba6a793f3fa0d692e14ab684c"
|
source = "git+https://git.asonix.dog/asonix/multipart-client-stream#b655ef851145ea120d637ff7bfb6a3e8964281c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
|
@ -766,6 +766,7 @@ dependencies = [
|
||||||
"rand",
|
"rand",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -881,18 +882,18 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.65"
|
version = "1.0.66"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "92de25114670a878b1261c79c9f8f729fb97e95bac93f6312f583c60dd6a1dfe"
|
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.30"
|
version = "1.0.31"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5907a1b7c277254a8b15170f6e7c97cfa60ee7872a3217663bb81151e48184bb"
|
checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
22
src/main.rs
22
src/main.rs
|
@ -22,6 +22,7 @@ use tokio::{
|
||||||
},
|
},
|
||||||
task::JoinSet,
|
task::JoinSet,
|
||||||
};
|
};
|
||||||
|
use tracing::Instrument;
|
||||||
use tracing_subscriber::{filter::Targets, layer::SubscriberExt, Layer, Registry};
|
use tracing_subscriber::{filter::Targets, layer::SubscriberExt, Layer, Registry};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
@ -132,7 +133,7 @@ impl State {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip_all)]
|
||||||
async fn visit_dir(&self, path: &Path) -> color_eyre::Result<()> {
|
async fn visit_dir(&self, path: &Path) -> color_eyre::Result<()> {
|
||||||
let mut read_dir = tokio::fs::read_dir(path).await?;
|
let mut read_dir = tokio::fs::read_dir(path).await?;
|
||||||
|
|
||||||
|
@ -158,12 +159,15 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
let this = self.clone();
|
let this = self.clone();
|
||||||
set.spawn_local(async move {
|
set.spawn_local(
|
||||||
let file_type = entry.file_type().await?;
|
async move {
|
||||||
let path = entry.path();
|
let file_type = entry.file_type().await?;
|
||||||
|
let path = entry.path();
|
||||||
|
|
||||||
this.visit_path(&path, file_type).await
|
this.visit_path(&path, file_type).await
|
||||||
});
|
}
|
||||||
|
.instrument(tracing::info_span!("spawned")),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(res) = set.join_next().await {
|
while let Some(res) = set.join_next().await {
|
||||||
|
@ -206,7 +210,7 @@ impl StateInner {
|
||||||
.client
|
.client
|
||||||
.post(self.upload_endpoint())
|
.post(self.upload_endpoint())
|
||||||
.insert_header((CONTENT_TYPE, body.content_type()))
|
.insert_header((CONTENT_TYPE, body.content_type()))
|
||||||
.timeout(Duration::from_secs(60))
|
.timeout(Duration::from_secs(20))
|
||||||
.send_stream(body)
|
.send_stream(body)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
@ -226,7 +230,7 @@ impl StateInner {
|
||||||
|
|
||||||
let mut uploads = match response {
|
let mut uploads = match response {
|
||||||
UploadReponse::Error { msg } => {
|
UploadReponse::Error { msg } => {
|
||||||
tracing::warn!("Upload for {path:?} failed with message\n{msg}");
|
tracing::warn!("Upload failed with message\n{msg}");
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
UploadReponse::Ok { uploads, .. } => uploads,
|
UploadReponse::Ok { uploads, .. } => uploads,
|
||||||
|
@ -254,7 +258,7 @@ impl StateInner {
|
||||||
.client
|
.client
|
||||||
.get(&claim_endpoint)
|
.get(&claim_endpoint)
|
||||||
.query(upload)?
|
.query(upload)?
|
||||||
.timeout(Duration::from_secs(20))
|
.timeout(Duration::from_secs(15))
|
||||||
.send()
|
.send()
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue