in src/cartservice/src/services/CartService.cs [57:83]
public override async Task<Empty> EmptyCart(EmptyCartRequest request, ServerCallContext context)
{
var activity = Activity.Current;
activity?.SetTag("app.user.id", request.UserId);
activity?.AddEvent(new("Empty cart"));
try
{
// Throw 1/10 of the time to simulate a failure when the feature flag is enabled
if (await _featureFlagHelper.GetBooleanValue("cartServiceFailure", false) && random.Next(10) == 0)
{
await _badCartStore.EmptyCartAsync(request.UserId);
}
else
{
await _cartStore.EmptyCartAsync(request.UserId);
}
}
catch (RpcException ex)
{
Activity.Current?.RecordException(ex);
Activity.Current?.SetStatus(ActivityStatusCode.Error, ex.Message);
throw;
}
return Empty;
}