Skip to content

Commit

Permalink
feat: Add error handling to job checker (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser authored Jun 13, 2024
1 parent 0aebeee commit efaca02
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use rust_arroyo::backends::kafka::config::KafkaConfig;
use tokio_cron_scheduler::{Job, JobScheduler, JobSchedulerError};
use tracing::info;
use tracing::{error, info};

use crate::checker::Checker;
use crate::config::Config;
Expand All @@ -28,7 +28,10 @@ pub async fn run_scheduler(config: &Config) -> Result<(), JobSchedulerError> {
let check_result = job_checker
.check_url("https://downtime-simulator-test1.vercel.app")
.await;
let _ = job_producer.produce_checker_result(&check_result).await;

if let Err(e) = job_producer.produce_checker_result(&check_result).await {
error!(error = ?e, "Failed to produce check result");
}

info!(result = ?check_result, "Check complete");
})
Expand Down

0 comments on commit efaca02

Please sign in to comment.