Skip to content

Commit 3d53949

Browse files
committed
refactor: remove unnecessary collect in GCP Pub/Sub sink
1 parent d2af593 commit 3d53949

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

src/sink/gcp_pubsub.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,20 +162,16 @@ impl Sink for GcpPubsubSink {
162162
.await;
163163

164164
// Wait for all messages to be confirmed concurrently.
165-
let futures: Vec<_> = awaiters
166-
.into_iter()
167-
.map(|awaiter| async move {
168-
awaiter.get().await.map_err(|e| {
169-
etl::etl_error!(
170-
etl::error::ErrorKind::DestinationError,
171-
"Failed to publish message to Pub/Sub",
172-
e.to_string()
173-
)
174-
})
165+
try_join_all(awaiters.into_iter().map(|awaiter| async move {
166+
awaiter.get().await.map_err(|e| {
167+
etl::etl_error!(
168+
etl::error::ErrorKind::DestinationError,
169+
"Failed to publish message to Pub/Sub",
170+
e.to_string()
171+
)
175172
})
176-
.collect();
177-
178-
try_join_all(futures).await?;
173+
}))
174+
.await?;
179175

180176
Ok(())
181177
}

0 commit comments

Comments
 (0)