mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
refactor(dynamic_routing): add support for shuffle on tie flag to success_based routing (#8241)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -23862,6 +23862,10 @@
|
|||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "double",
|
"format": "double",
|
||||||
"nullable": true
|
"nullable": true
|
||||||
|
},
|
||||||
|
"shuffle_on_tie_during_exploitation": {
|
||||||
|
"type": "boolean",
|
||||||
|
"nullable": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -45,6 +45,7 @@ paths:
|
|||||||
default_success_rate: 0.95
|
default_success_rate: 0.95
|
||||||
specificity_level: ENTITY
|
specificity_level: ENTITY
|
||||||
exploration_percent: 20.0
|
exploration_percent: 20.0
|
||||||
|
shuffle_on_tie_during_exploitation: true
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Success rate calculated successfully
|
description: Success rate calculated successfully
|
||||||
|
|||||||
@ -28802,6 +28802,10 @@
|
|||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "double",
|
"format": "double",
|
||||||
"nullable": true
|
"nullable": true
|
||||||
|
},
|
||||||
|
"shuffle_on_tie_during_exploitation": {
|
||||||
|
"type": "boolean",
|
||||||
|
"nullable": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1016,6 +1016,7 @@ impl Default for SuccessBasedRoutingConfig {
|
|||||||
}),
|
}),
|
||||||
specificity_level: SuccessRateSpecificityLevel::default(),
|
specificity_level: SuccessRateSpecificityLevel::default(),
|
||||||
exploration_percent: Some(20.0),
|
exploration_percent: Some(20.0),
|
||||||
|
shuffle_on_tie_during_exploitation: Some(false),
|
||||||
}),
|
}),
|
||||||
decision_engine_configs: None,
|
decision_engine_configs: None,
|
||||||
}
|
}
|
||||||
@ -1044,6 +1045,7 @@ pub struct SuccessBasedRoutingConfigBody {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub specificity_level: SuccessRateSpecificityLevel,
|
pub specificity_level: SuccessRateSpecificityLevel,
|
||||||
pub exploration_percent: Option<f64>,
|
pub exploration_percent: Option<f64>,
|
||||||
|
pub shuffle_on_tie_during_exploitation: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, ToSchema)]
|
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, ToSchema)]
|
||||||
@ -1173,6 +1175,9 @@ impl SuccessBasedRoutingConfigBody {
|
|||||||
if let Some(exploration_percent) = new.exploration_percent {
|
if let Some(exploration_percent) = new.exploration_percent {
|
||||||
self.exploration_percent = Some(exploration_percent);
|
self.exploration_percent = Some(exploration_percent);
|
||||||
}
|
}
|
||||||
|
if let Some(shuffle_on_tie_during_exploitation) = new.shuffle_on_tie_during_exploitation {
|
||||||
|
self.shuffle_on_tie_during_exploitation = Some(shuffle_on_tie_during_exploitation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -291,6 +291,7 @@ impl ForeignTryFrom<SuccessBasedRoutingConfigBody> for CalSuccessRateConfig {
|
|||||||
SuccessRateSpecificityLevel::Global => Some(ProtoSpecificityLevel::Global.into()),
|
SuccessRateSpecificityLevel::Global => Some(ProtoSpecificityLevel::Global.into()),
|
||||||
},
|
},
|
||||||
exploration_percent: config.exploration_percent,
|
exploration_percent: config.exploration_percent,
|
||||||
|
shuffle_on_tie_during_exploitation: config.shuffle_on_tie_during_exploitation,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ message CalSuccessRateConfig {
|
|||||||
double default_success_rate = 2;
|
double default_success_rate = 2;
|
||||||
optional SuccessRateSpecificityLevel specificity_level = 3;
|
optional SuccessRateSpecificityLevel specificity_level = 3;
|
||||||
optional double exploration_percent = 4;
|
optional double exploration_percent = 4;
|
||||||
|
optional bool shuffle_on_tie_during_exploitation = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SuccessRateSpecificityLevel {
|
enum SuccessRateSpecificityLevel {
|
||||||
@ -78,7 +79,7 @@ message UpdateSuccessRateWindowResponse {
|
|||||||
UpdationStatus status = 1;
|
UpdationStatus status = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// API-3 types
|
// API-3 types
|
||||||
message InvalidateWindowsRequest {
|
message InvalidateWindowsRequest {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user