Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make load balancing configurable #1573

Merged
merged 13 commits into from
Apr 6, 2024
11 changes: 1 addition & 10 deletions crates/ott-balancer/src/balancer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,7 @@ pub struct BalancerContext {
}
impl BalancerContext {
pub fn new() -> Self {
if BalancerConfig::get().selection_strategy.is_some() {
BalancerContext {
monolith_selection: BalancerConfig::get()
.selection_strategy
.expect("selection strategy not set"),
..BalancerContext::default()
}
} else {
BalancerContext::default()
}
Default::default()
}

#[instrument(skip(self, client), err, fields(client_id = %client.id, room = %client.room))]
Expand Down
13 changes: 13 additions & 0 deletions crates/ott-balancer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ pub async fn run() -> anyhow::Result<()> {

let config = BalancerConfig::get();

if config.selection_strategy.is_some() {
info!("Using selection strategy: {:?}", config.selection_strategy);
BalancerContext {
monolith_selection: config
.selection_strategy
.expect("selection strategy not set"),
Victor-M-Giraldo marked this conversation as resolved.
Show resolved Hide resolved
..BalancerContext::default()
}
} else {
info!("Using default selection strategy");
BalancerContext::default()
};
Victor-M-Giraldo marked this conversation as resolved.
Show resolved Hide resolved

let console_layer = if args.console {
let console_layer = if args.remote_console {
console_subscriber::ConsoleLayer::builder()
Expand Down
Loading