Proxy: reduce number of get role secret calls (#6557)

## Problem

Right now if get_role_secret response wasn't cached (e.g. cache already
reached max size) it will send the second (exactly the same request).

## Summary of changes

Avoid needless request.
This commit is contained in:
Anna Khanova
2024-01-31 23:16:56 +01:00
committed by GitHub
parent 3d5fab127a
commit 271133d960
6 changed files with 41 additions and 29 deletions

View File

@@ -540,7 +540,7 @@ async fn connect_to_compute(
.map(|_| conn_info.user_info.clone());
if !config.disable_ip_check_for_http {
let allowed_ips = backend.get_allowed_ips(ctx).await?;
let (allowed_ips, _) = backend.get_allowed_ips_and_secret(ctx).await?;
if !check_peer_addr_is_in_list(&ctx.peer_addr, &allowed_ips) {
return Err(auth::AuthError::ip_address_not_allowed().into());
}