feat: use new tokio stream
Some checks reported errors
continuous-integration/drone/push Build encountered an error

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-05-26 15:45:40 +02:00
parent b12653b9e9
commit 9601cfa980
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394
3 changed files with 12 additions and 39 deletions

39
Cargo.lock generated
View File

@ -122,22 +122,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a"
dependencies = [ dependencies = [
"concurrent-queue", "concurrent-queue",
"event-listener-strategy 0.5.2", "event-listener-strategy",
"futures-core", "futures-core",
"pin-project-lite", "pin-project-lite",
] ]
[[package]]
name = "async-lock"
version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b"
dependencies = [
"event-listener 4.0.3",
"event-listener-strategy 0.4.0",
"pin-project-lite",
]
[[package]] [[package]]
name = "async-stream" name = "async-stream"
version = "0.3.5" version = "0.3.5"
@ -762,12 +751,11 @@ dependencies = [
[[package]] [[package]]
name = "blocking" name = "blocking"
version = "1.6.0" version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "495f7104e962b7356f0aeb34247aca1fe7d2e783b346582db7f2904cb5717e88" checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea"
dependencies = [ dependencies = [
"async-channel", "async-channel",
"async-lock",
"async-task", "async-task",
"futures-io", "futures-io",
"futures-lite", "futures-lite",
@ -1201,17 +1189,6 @@ version = "2.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "event-listener"
version = "4.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e"
dependencies = [
"concurrent-queue",
"parking",
"pin-project-lite",
]
[[package]] [[package]]
name = "event-listener" name = "event-listener"
version = "5.3.0" version = "5.3.0"
@ -1223,16 +1200,6 @@ dependencies = [
"pin-project-lite", "pin-project-lite",
] ]
[[package]]
name = "event-listener-strategy"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3"
dependencies = [
"event-listener 4.0.3",
"pin-project-lite",
]
[[package]] [[package]]
name = "event-listener-strategy" name = "event-listener-strategy"
version = "0.5.2" version = "0.5.2"

View File

@ -22,9 +22,14 @@ serde_json = "1.0.113"
nats = "0.24.1" nats = "0.24.1"
walkdir = "2.4.0" walkdir = "2.4.0"
tar = "0.4.40" tar = "0.4.40"
tokio-stream = { version = "0.1.14", features = ["full"] } tokio-stream = { version = "0.1.15", features = ["full"] }
rand = "0.8.5" rand = "0.8.5"
sqlx = { version = "0.7.3", features = ["postgres", "runtime-tokio", "uuid", "chrono"] } sqlx = { version = "0.7.3", features = [
"postgres",
"runtime-tokio",
"uuid",
"chrono",
] }
chrono = "0.4.34" chrono = "0.4.34"
git2 = "0.18.3" git2 = "0.18.3"

View File

@ -25,11 +25,12 @@ impl FluxReleaserUploader {
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let iter = tokio_stream::iter(chunks);
let resp = self let resp = self
.flux_client .flux_client
.lock() .lock()
.await .await
.upload_artifact(tonic::Request::new(tokio_stream::iter(chunks))) .upload_artifact(tonic::Request::new(iter))
.await?; .await?;
resp.into_inner().upload_id.try_into() resp.into_inner().upload_id.try_into()