I want to return from a request if there's already a request in process from that client.
// Controller
public async Task<IHttpActionResult> GetBarcode(string ticketId)
{
var customerGuid = Guid.Parse(User.Identity.GetUserId());
var ticketGuid = Guid.Parse(ticketId);
return Json(await _service.GetBarcode(customerGuid, ticketGuid));
}
// Service
public async Task<TicketBarcode> GetBarcode(Guid customerId, Guid ticketId)
{
// if already processing a request with this customerId and ticketId, then return
// if not, then proceed
It calls another API which can't handle the pressure.
I'm asking for advice how to achieve this. If you need more info, please comment.