From cdee9cfb9b593290c06f691ed68df38e62c86120 Mon Sep 17 00:00:00 2001 From: cartermp Date: Sat, 17 Sep 2022 12:05:43 -0700 Subject: [PATCH] GetCart should be async? --- src/cartservice/src/services/CartService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cartservice/src/services/CartService.cs b/src/cartservice/src/services/CartService.cs index d19027c8da..edfdff3af6 100644 --- a/src/cartservice/src/services/CartService.cs +++ b/src/cartservice/src/services/CartService.cs @@ -41,15 +41,16 @@ public async override Task AddItem(AddItemRequest request, ServerCallCont return Empty; } - public override Task GetCart(GetCartRequest request, ServerCallContext context) + public async override Task GetCart(GetCartRequest request, ServerCallContext context) { var activity = Activity.Current; activity?.SetTag("app.user.id", request.UserId); activity?.AddEvent(new("Fetch cart")); - var cart = _cartStore.GetCartAsync(request.UserId); + var cart = await _cartStore.GetCartAsync(request.UserId); var totalCart = 0; - foreach (CartItem item in cart.Result.Items) { + foreach (var item in cart.Items) + { totalCart += item.Quantity; } activity?.SetTag("app.cart.items.count", totalCart);