File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " oxybox"
3- version = " 1.0.4 "
3+ version = " 1.0.5 "
44authors = [" Thomas Luijken" ]
55categories = [" command-line-utilities" ]
66description = " A drop in replacement for blackbox exporter for Prometheus, with support for TLS and HTTP/3."
Original file line number Diff line number Diff line change @@ -233,6 +233,8 @@ pub async fn run_probe_loop(
233233 loop {
234234 let mut handles = vec ! [ ] ;
235235
236+ let start_time = Instant :: now ( ) ;
237+
236238 for target in & org_config. targets {
237239 let connector = tls_connector. clone ( ) ;
238240 let resolver = resolver. clone ( ) ;
@@ -241,7 +243,9 @@ pub async fn run_probe_loop(
241243 let org_id = org_config. organisation_id . clone ( ) ;
242244 let mimir_endpoint = mimir_endpoint. clone ( ) ;
243245
244- handles. push ( tokio:: spawn ( async move {
246+ let probe_timeout_duration: Duration = Duration :: from_secs ( org_config. polling_interval_seconds ) ;
247+
248+ handles. push ( tokio:: spawn ( tokio:: time:: timeout ( probe_timeout_duration, async move {
245249 handle_target_probe (
246250 tenant_name,
247251 & org_id,
@@ -252,15 +256,17 @@ pub async fn run_probe_loop(
252256 max_org_width,
253257 )
254258 . await ;
255- } ) ) ;
259+ } ) ) ) ;
256260 }
257261
258262 for handle in handles {
259263 if let Err ( join_err) = handle. await {
260264 log:: error!( "Task panicked: {:?}" , join_err) ;
261265 }
262266 }
263- sleep ( Duration :: from_secs ( org_config. polling_interval_seconds ) ) . await ;
267+ let elapsed = start_time. elapsed ( ) ;
268+
269+ sleep ( Duration :: from_secs ( org_config. polling_interval_seconds - elapsed. as_secs ( ) ) ) . await ;
264270 }
265271}
266272
You can’t perform that action at this time.
0 commit comments