Please consider following scenario in an MVC website:
public JsonResult DoSomething()
{
var result = PerformActionOne();
_loggerService.LogActionAsync()
return Json ({ Success = result });
}
The idea is to perform some action and log that the action happened. However, the log calls some third party api and regardless of if the action was logged, I want the code to continue running and return result. As such I do not care to wait for logging action to complete, I just want to call it and forget it.
Question:
Will this approach lead to a deadlock or another type of problem or maybe it is just considered bad practice and why? Does it differ between MVC5 and .NET 5?