initial commit
This commit is contained in:
commit
e26c6d4273
|
@ -0,0 +1 @@
|
|||
/target
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,12 @@
|
|||
[package]
|
||||
name = "get_a_thousand_status_codes"
|
||||
version = "0.1.0"
|
||||
authors = ["Jan Christian Grünhage <jan.christian@gruenhage.xyz>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
reqwest = "0.10.7"
|
||||
tokio = { version = "0.2.22", features = ["rt-threaded", "macros"] }
|
||||
futures-util = "0.3.5"
|
|
@ -0,0 +1,17 @@
|
|||
#[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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue