Skip to content

Commit 4da2e39

Browse files
committed
admin/populate: Use StdRng instead of ThreadRng
`ThreadRng` is not `Send` which is required to be able to use it across await-points with `tokio`.
1 parent cf322b4 commit 4da2e39

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/admin/populate.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ use crate::{db, schema::version_downloads};
22

33
use crate::tasks::spawn_blocking;
44
use diesel::prelude::*;
5-
use rand::{thread_rng, Rng};
5+
use rand::rngs::StdRng;
6+
use rand::{Rng, SeedableRng};
67

78
#[derive(clap::Parser, Debug)]
89
#[command(
@@ -27,7 +28,7 @@ fn update(opts: Opts, conn: &mut PgConnection) -> QueryResult<()> {
2728
use diesel::dsl::*;
2829

2930
for id in opts.version_ids {
30-
let mut rng = thread_rng();
31+
let mut rng = StdRng::from_entropy();
3132
let mut dls = rng.gen_range(5_000i32..10_000);
3233

3334
for day in 0..90 {

0 commit comments

Comments
 (0)