mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
feat(scheduler): default connector mapping for adding process
This commit is contained in:
committed by
Sanchith Hegde
parent
2a2febb0f8
commit
4f74b65b71
@ -25,3 +25,17 @@ pub struct ConnectorPTMapping {
|
||||
pub custom_merchant_mapping: HashMap<String, RetryMapping>,
|
||||
pub max_retries_count: i32,
|
||||
}
|
||||
|
||||
impl ConnectorPTMapping {
|
||||
pub fn default() -> Self {
|
||||
Self {
|
||||
custom_merchant_mapping: HashMap::new(),
|
||||
default_mapping: RetryMapping {
|
||||
start_after: 60,
|
||||
frequency: vec![300],
|
||||
count: vec![5],
|
||||
},
|
||||
max_retries_count: 5,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,9 +93,14 @@ pub async fn get_sync_process_schedule_time(
|
||||
redis: sync::Arc<redis::RedisConnectionPool>,
|
||||
retry_count: i32,
|
||||
) -> Result<Option<time::PrimitiveDateTime>, errors::ProcessTrackerError> {
|
||||
let mapping: process_data::ConnectorPTMapping = redis
|
||||
.get_and_deserialize_key(connector, "ConnectorPTMapping")
|
||||
.await?;
|
||||
let redis_mapping: errors::CustomResult<process_data::ConnectorPTMapping, errors::RedisError> =
|
||||
redis
|
||||
.get_and_deserialize_key(&format!("pt_mapping_{}", connector), "ConnectorPTMapping")
|
||||
.await;
|
||||
let mapping = match redis_mapping {
|
||||
Ok(x) => x,
|
||||
Err(_) => process_data::ConnectorPTMapping::default(),
|
||||
};
|
||||
let time_delta = get_sync_schedule_time(mapping, merchant_id, retry_count + 1);
|
||||
|
||||
Ok(pt_utils::get_time_from_delta(time_delta))
|
||||
|
||||
Reference in New Issue
Block a user