File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ bytes = "1.0"
45
45
env_logger = " 0.11"
46
46
juniper = { version = " 0.16" , path = " ../juniper" , features = [" expose-test-schema" ] }
47
47
log = " 0.4"
48
- rand = " 0.8 "
48
+ rand = " 0.9 "
49
49
tokio = " 1.0"
50
50
51
51
[[example ]]
Original file line number Diff line number Diff line change @@ -85,12 +85,13 @@ impl Subscription {
85
85
Second result will be an error."
86
86
) ]
87
87
async fn random_human ( context : & Database ) -> RandomHumanStream {
88
+ use rand:: { rngs:: StdRng , Rng as _, SeedableRng as _} ;
89
+
88
90
let mut counter = 0 ;
89
91
90
92
let context = ( * context) . clone ( ) ;
91
93
92
- use rand:: { rngs:: StdRng , Rng , SeedableRng } ;
93
- let mut rng = StdRng :: from_entropy ( ) ;
94
+ let mut rng = StdRng :: from_os_rng ( ) ;
94
95
let mut interval = tokio:: time:: interval ( Duration :: from_secs ( 5 ) ) ;
95
96
let stream = async_stream:: stream! {
96
97
counter += 1 ;
@@ -102,7 +103,7 @@ impl Subscription {
102
103
graphql_value!( "some additional string" ) ,
103
104
) )
104
105
} else {
105
- let random_id = rng. gen_range ( 1000 ..1005 ) . to_string( ) ;
106
+ let random_id = rng. random_range ( 1000 ..1005 ) . to_string( ) ;
106
107
let human = context. get_human( & random_id) . unwrap( ) . clone( ) ;
107
108
108
109
yield Ok ( RandomHuman {
You can’t perform that action at this time.
0 commit comments