Asynchronous Method Blocking Queue

Asked

Viewed 120 times

1

I’m using MVC and so I approached asynchronous methods for Actions in Controllers in order not to block access to other pages of the site while a long-term process is taking place.

However, I have had problems in the following scenario:

The long-term process is a completion of Reserve and goes through several processes. In this way, I created the following Action (which is called through a POST via AJAX):

[HttpPost]
public async Task<ActionResult> Finalizar(bool? isMultiple)
{
    //obtendo os dados finais armazenados num tempdata
    var reserva = (ReservaViewModel)TempData["Reserva"];

    //chamada do metodo assincrono
    var result = await _reservaAsyncAppService.FinalizarReserva(reserva);

    //restando do codigo...
}

I have the following Action which is the Home of the Site, I did asynchronously:

public async Task<ActionResult> Index()
{
    ViewBag.Portfolio = await _programaAppService.ListarPortfolioAsync();

    return View();
}

Doubt: When I start the Finalizing of the Reservation, in another tab I try to access the Home of the site, however, it stays reading for a few seconds and when it finishes the Reservation process it opens the Home.

I wanted to know why this is happening, I am using asynchronous methods in both actions, I believe that I should not have this kind of blocking in the request queue.

I realized that when starting the completion of the reservation and during the process in another browser access to Home it opens normally, without queue blocking, but when starting the booking completion process try to open the Home in another tab of the same browser the lock happens. This is normal ?

If you can help me, I’d appreciate it.

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.