add timestamp, add test URLs
This commit is contained in:
parent
e26c6d4273
commit
1482337bf0
4 changed files with 1036 additions and 4 deletions
31
Cargo.lock
generated
31
Cargo.lock
generated
|
@ -42,6 +42,17 @@ version = "0.1.10"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b"
|
||||
dependencies = [
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.7.0"
|
||||
|
@ -172,6 +183,7 @@ dependencies = [
|
|||
name = "get_a_thousand_status_codes"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"futures-util",
|
||||
"reqwest",
|
||||
"tokio",
|
||||
|
@ -459,6 +471,25 @@ dependencies = [
|
|||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.13.0"
|
||||
|
|
|
@ -10,3 +10,4 @@ edition = "2018"
|
|||
reqwest = "0.10.7"
|
||||
tokio = { version = "0.2.22", features = ["rt-threaded", "macros"] }
|
||||
futures-util = "0.3.5"
|
||||
chrono = "0.4.15"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#[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| {
|
||||
for url in include_str!("../test-urls.txt").split("\n") {
|
||||
handles.push(tokio::spawn(async move {
|
||||
match reqwest::ClientBuilder::new().user_agent("Test/contact: admin@cryto.net").build().unwrap().get(url).send().await.and_then(|resp| {
|
||||
Ok(resp.status())
|
||||
}) {
|
||||
Ok(status) => println!("{}", status),
|
||||
Ok(status) => println!("{}, {}", status, chrono::Utc::now()),
|
||||
Err(_) => eprintln!("Something went wrong here"),
|
||||
};
|
||||
}));
|
||||
|
|
1000
test-urls.txt
Normal file
1000
test-urls.txt
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue