5

I have a process I would like to run in the background. This is executed with a click of an action link.

Action to call:

   public async Task<ActionResult> ProcessRec()
   {
        await Task.Run(() => waitTimer());
        return RedirectToAction("Index", "Home");
   }

   public void waitTimer()
   {
        Thread.Sleep(10000);
   }

This however waits for the full 10 seconds before redirecting me to my "Index, Home" action. I am very new to Await/Async so I know I am interpreting something wrong here. How do I get the application to return to this action, while the waitTimer is executing in the background? Thanks!!


Linked


Related

Latest