18 lines
489 B
Rust
18 lines
489 B
Rust
|
#[tokio::main]
|
||
|
async fn main() {
|
||
|
let mut handles = Vec::with_capacity(1000);
|
||
|
for _ in 0..1000 {
|
||
|
handles.push(tokio::spawn(async {
|
||
|
match reqwest::get("http://localhost:2015").await.and_then(|resp| {
|
||
|
Ok(resp.status())
|
||
|
}) {
|
||
|
Ok(status) => println!("{}", status),
|
||
|
Err(_) => eprintln!("Something went wrong here"),
|
||
|
};
|
||
|
}));
|
||
|
}
|
||
|
for handle in handles {
|
||
|
handle.await;
|
||
|
}
|
||
|
}
|