mirror of
https://github.com/rust-unofficial/awesome-rust
synced 2024-11-16 06:12:56 +00:00
Only write every so often
This commit is contained in:
parent
b4cea8a4c2
commit
edc17508e1
12
src/main.rs
12
src/main.rs
@ -261,6 +261,8 @@ async fn main() -> Result<(), Error> {
|
||||
}
|
||||
fs::write("results/results.yaml", serde_yaml::to_string(&results)?)?;
|
||||
|
||||
let mut not_written = 0;
|
||||
let mut last_written = Local::now();
|
||||
while url_checks.len() > 0 {
|
||||
debug!("Waiting...");
|
||||
let ((url, res), _index, remaining) = select_all(url_checks).await;
|
||||
@ -324,8 +326,16 @@ async fn main() -> Result<(), Error> {
|
||||
}
|
||||
}
|
||||
std::io::stdout().flush().unwrap();
|
||||
fs::write("results/results.yaml", serde_yaml::to_string(&results)?)?;
|
||||
|
||||
not_written += 1;
|
||||
let duration = Local::now() - last_written;
|
||||
if duration > Duration::seconds(5) || not_written > 20 {
|
||||
fs::write("results/results.yaml", serde_yaml::to_string(&results)?)?;
|
||||
not_written = 0;
|
||||
last_written = Local::now();
|
||||
}
|
||||
}
|
||||
fs::write("results/results.yaml", serde_yaml::to_string(&results)?)?;
|
||||
println!("");
|
||||
let mut failed: u32 = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user