Skip to content

Commit b45354a

Browse files
committed
Upd code
1 parent ce238af commit b45354a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

juniper_actix/examples/subscription.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,13 @@ impl Subscription {
8585
Second result will be an error."
8686
)]
8787
async fn random_human(context: &Database) -> RandomHumanStream {
88+
use rand::{rngs::StdRng, Rng as _, SeedableRng as _};
89+
8890
let mut counter = 0;
8991

9092
let context = (*context).clone();
9193

92-
use rand::{rngs::StdRng, Rng, SeedableRng};
93-
let mut rng = StdRng::from_entropy();
94+
let mut rng = StdRng::from_os_rng();
9495
let mut interval = tokio::time::interval(Duration::from_secs(5));
9596
let stream = async_stream::stream! {
9697
counter += 1;
@@ -102,7 +103,7 @@ impl Subscription {
102103
graphql_value!("some additional string"),
103104
))
104105
} else {
105-
let random_id = rng.gen_range(1000..1005).to_string();
106+
let random_id = rng.random_range(1000..1005).to_string();
106107
let human = context.get_human(&random_id).unwrap().clone();
107108

108109
yield Ok(RandomHuman {

0 commit comments

Comments
 (0)