Browse Source

Await futures in random order

We don't care in which order they resolve, we are storing them
in a hashmap.
refactor/no-log-handler
Thomas Eizinger 3 years ago
parent
commit
b0129aef77
No known key found for this signature in database GPG Key ID: 651AC83A6C6C8B96
  1. 4
      daemon/src/oracle.rs

4
daemon/src/oracle.rs

@ -4,7 +4,7 @@ use crate::model::OracleEventId;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use async_trait::async_trait; use async_trait::async_trait;
use cfd_protocol::secp256k1_zkp::{schnorrsig, SecretKey}; use cfd_protocol::secp256k1_zkp::{schnorrsig, SecretKey};
use futures::stream::FuturesOrdered; use futures::stream::FuturesUnordered;
use futures::TryStreamExt; use futures::TryStreamExt;
use reqwest::StatusCode; use reqwest::StatusCode;
use rocket::time::format_description::FormatItem; use rocket::time::format_description::FormatItem;
@ -106,7 +106,7 @@ where
.context("Failed to deserialize as Announcement")?; .context("Failed to deserialize as Announcement")?;
Result::<_, anyhow::Error>::Ok((event_id, announcement)) Result::<_, anyhow::Error>::Ok((event_id, announcement))
}) })
.collect::<FuturesOrdered<_>>() .collect::<FuturesUnordered<_>>()
.try_collect::<HashMap<_, _>>() .try_collect::<HashMap<_, _>>()
.await?; .await?;

Loading…
Cancel
Save