announcing good-first-issue tags added on @tangled.sh (not affiliated with tangled!)

add a healthcheck ping

Changed files
+24
src
+24
src/main.rs
··· 50 50 /// don't actually post 51 51 #[arg(long, action)] 52 52 dry_run: bool, 53 + /// send a checkin to this url every 5 mins 54 + #[arg(long)] 55 + healtcheck_ping: Option<Url>, 53 56 } 54 57 55 58 struct IssueDetails { ··· 292 295 Ok(()) 293 296 } 294 297 298 + async fn hc_ping(url: Url, client: reqwest::Client) { 299 + let mut interval = tokio::time::interval(Duration::from_secs(5 * 60)); 300 + loop { 301 + interval.tick().await; 302 + log::trace!("sending healtcheck ping..."); 303 + if let Err(e) = client 304 + .get(url.clone()) 305 + .send() 306 + .await 307 + .and_then(reqwest::Response::error_for_status) 308 + { 309 + log::warn!("error sending healtcheck ping: {e}"); 310 + } 311 + } 312 + } 313 + 295 314 #[tokio::main] 296 315 async fn main() -> Result<()> { 297 316 env_logger::init(); ··· 325 344 let mut receiver = JetstreamConnector::new(jetstream_config)? 326 345 .connect_cursor(args.jetstream_cursor.map(Cursor::from_raw_u64)) 327 346 .await?; 347 + 348 + if let Some(hc) = args.healtcheck_ping { 349 + log::info!("starting healtcheck ping task..."); 350 + tokio::task::spawn(hc_ping(hc.clone(), slingshot_client.clone())); 351 + } 328 352 329 353 log::info!("receiving jetstream messages..."); 330 354 loop {