mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 02:57:02 +08:00
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>
47 lines
1.1 KiB
Rust
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(())
|
|
}
|