Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
在一个Action中执行耗时长且不关心返回值的方法
[HttpGet]
public async Task<IActionResult> LongTimeAction()
{
var longtimeFunc = async () =>
{
await Task.Delay(1000 * 10);
_logger.LogInformation("after delay");
};
_ = longtimeFunc.Invoke();
return this.Ok();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment