Skip to content

Commit

Permalink
Upgrade rand crate from 0.8 to 0.9 version (#1309)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kai Ren <[email protected]>
  • Loading branch information
dependabot[bot] and tyranron authored Jan 27, 2025
1 parent f049481 commit 6845dba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion juniper_actix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bytes = "1.0"
env_logger = "0.11"
juniper = { version = "0.16", path = "../juniper", features = ["expose-test-schema"] }
log = "0.4"
rand = "0.8"
rand = "0.9"
tokio = "1.0"

[[example]]
Expand Down
7 changes: 4 additions & 3 deletions juniper_actix/examples/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ impl Subscription {
Second result will be an error."
)]
async fn random_human(context: &Database) -> RandomHumanStream {
use rand::{rngs::StdRng, Rng as _, SeedableRng as _};

let mut counter = 0;

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

use rand::{rngs::StdRng, Rng, SeedableRng};
let mut rng = StdRng::from_entropy();
let mut rng = StdRng::from_os_rng();
let mut interval = tokio::time::interval(Duration::from_secs(5));
let stream = async_stream::stream! {
counter += 1;
Expand All @@ -102,7 +103,7 @@ impl Subscription {
graphql_value!("some additional string"),
))
} else {
let random_id = rng.gen_range(1000..1005).to_string();
let random_id = rng.random_range(1000..1005).to_string();
let human = context.get_human(&random_id).unwrap().clone();

yield Ok(RandomHuman {
Expand Down

0 comments on commit 6845dba

Please sign in to comment.