diff --git a/svc/pkg/ip/ops/info/src/lib.rs b/svc/pkg/ip/ops/info/src/lib.rs index 97351332a4..c099ddd838 100644 --- a/svc/pkg/ip/ops/info/src/lib.rs +++ b/svc/pkg/ip/ops/info/src/lib.rs @@ -29,7 +29,25 @@ async fn handle(ctx: OperationContext) -> GlobalResult fetch_ip_info_io(&ctx, ctx.ts(), &ip_str).await?, + ip::info::Provider::IpInfoIo => { + ctx.cache() + .fetch_one_proto("ipinfo.ip", ip_str, { + let ctx = ctx.clone(); + move |mut cache, ip_str| { + let ctx = ctx.clone(); + async move { + let ip_info = fetch_ip_info_io(&ctx, ctx.ts(), &ip_str).await?; + if let Some(ip_info) = ip_info { + cache.resolve(&ip_str, ip_info); + } else { + // TODO(RVT-3792): Cache miss will hit database all of the time + } + Ok(cache) + } + } + }) + .await? + } }; Ok(ip::info::Response { ip_info })