【发布时间】:2019-04-05 18:59:58
【问题描述】:
如果该客户端的请求已经在处理中,我想从请求中返回。
// 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
它调用了另一个无法处理压力的 API。
我正在寻求如何实现这一目标的建议。如果您需要更多信息,请发表评论。
【问题讨论】:
-
谢谢,但它是核心,这是框架。
-
是的,抱歉,如果找不到其他内容,您可以获取代码并采用它。
标签: c# asp.net-web-api