Files
hyperswitch/crates/router/src/scheduler.rs
Prajjwal Kumar 13185999d5 feat(Core): gracefully shutdown router/scheduler if Redis is unavailable (#891)
Co-authored-by: prajjwal kumar <prajjwal.kumar@prajjwalkumar-DWKH9NPY4R.local>
Co-authored-by: Nishant Joshi <nishant.joshi@juspay.in>
Co-authored-by: Arun Raj M <jarnura47@gmail.com>
2023-04-24 07:38:00 +00:00

47 lines
1.1 KiB
Rust

#![allow(dead_code)]
pub mod consumer;
pub mod metrics;
pub mod producer;
pub mod types;
pub mod utils;
pub mod workflows;
use std::sync::Arc;
use tokio::sync::mpsc;
pub use self::types::*;
use crate::{
configs::settings::SchedulerSettings,
core::errors::{self, CustomResult},
logger::error,
routes::AppState,
};
pub async fn start_process_tracker(
state: &AppState,
scheduler_flow: SchedulerFlow,
scheduler_settings: Arc<SchedulerSettings>,
channel: (mpsc::Sender<()>, mpsc::Receiver<()>),
) -> CustomResult<(), errors::ProcessTrackerError> {
match scheduler_flow {
SchedulerFlow::Producer => {
producer::start_producer(state, scheduler_settings, channel).await?
}
SchedulerFlow::Consumer => {
consumer::start_consumer(
state,
scheduler_settings,
workflows::runner_from_task,
channel,
)
.await?
}
SchedulerFlow::Cleaner => {
error!("This flow has not been implemented yet!");
}
}
Ok(())
}