mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 05:17:02 +08:00
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>
This commit is contained in:
@ -9,6 +9,8 @@ pub mod workflows;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
pub use self::types::*;
|
||||
use crate::{
|
||||
configs::settings::SchedulerSettings,
|
||||
@ -21,11 +23,20 @@ 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).await?,
|
||||
SchedulerFlow::Producer => {
|
||||
producer::start_producer(state, scheduler_settings, channel).await?
|
||||
}
|
||||
SchedulerFlow::Consumer => {
|
||||
consumer::start_consumer(state, scheduler_settings, workflows::runner_from_task).await?
|
||||
consumer::start_consumer(
|
||||
state,
|
||||
scheduler_settings,
|
||||
workflows::runner_from_task,
|
||||
channel,
|
||||
)
|
||||
.await?
|
||||
}
|
||||
SchedulerFlow::Cleaner => {
|
||||
error!("This flow has not been implemented yet!");
|
||||
|
||||
Reference in New Issue
Block a user