Skip to content

Commit

Permalink
fix(mm): broken cache (#806)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
NathanFlurry committed May 31, 2024
1 parent d9ee67f commit b9df980
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions svc/pkg/mm-config/ops/version-get/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,35 @@ async fn handle(
.map(common::Uuid::as_uuid)
.collect::<Vec<_>>();

let versions = ctx
.cache()
.immutable()
.fetch_all_proto("versions", req_version_ids, |mut cache, req_version_ids| {
let ctx = ctx.base();
let versions = fetch_versions(&ctx.base(), req_version_ids)
.await?
.into_iter()
.map(|x| x.1)
.collect::<Vec<_>>();

async move {
fetch_versions(&ctx, req_version_ids)
.await?
.into_iter()
.for_each(|(version_id, version)| {
cache.resolve_with_topic(
&version_id,
version,
("game_mm_versions", &version_id),
)
});
Ok(cache)
}
})
.await?;
// TODO: There's a bug with this that returns the lobby groups for the wrong
// version, can't figure this out
// let versions = ctx
// .cache()
// .immutable()
// .fetch_all_proto("versions", req_version_ids, |mut cache, req_version_ids| {
// let ctx = ctx.base();
//
// async move {
// fetch_versions(&ctx, req_version_ids)
// .await?
// .into_iter()
// .for_each(|(version_id, version)| {
// cache.resolve_with_topic(
// &version_id,
// version,
// ("game_mm_versions", &version_id),
// )
// });
// Ok(cache)
// }
// })
// .await?;

Ok(mm_config::version_get::Response { versions })
}
Expand Down

0 comments on commit b9df980

Please sign in to comment.