feat: Added a way to configure loop delay in seconds
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
a81caddd33
commit
8bafa49bec
@ -24,6 +24,8 @@ async fn main() {
|
||||
.expect("Environment variable 'ROUTER_PASSWORD' not set.");
|
||||
let hostname = std::env::var("HOSTNAME")
|
||||
.expect("Environment variable 'HOSTNAME' not set.");
|
||||
let loop_delay = std::env::var("LOOP_DELAY")
|
||||
.expect("Environment variable 'LOOP_DELAY' not set.").parse().unwrap_or(60);
|
||||
|
||||
|
||||
let i_client = influxdb2::Client::new(host, org, token);
|
||||
@ -56,8 +58,9 @@ async fn main() {
|
||||
i_client.write(bucket.as_str(), stream::iter(datapoints)).await
|
||||
.unwrap();
|
||||
debug!("Datapoints sent. Took {:.2?}.", now.elapsed());
|
||||
info!("End of loop. Took {:.2?}. Waiting for 60 seconds.", start.elapsed());
|
||||
std::thread::sleep(Duration::from_secs(5));
|
||||
info!("End of loop. Took {:.2?}. Waiting for {} seconds.",
|
||||
start.elapsed(), loop_delay);
|
||||
std::thread::sleep(Duration::from_secs(loop_delay));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user