Skip to content

Instantly share code, notes, and snippets.

@frisktale
Created May 17, 2022 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frisktale/809ab236c93d1d6967f01cde49fc9528 to your computer and use it in GitHub Desktop.
Save frisktale/809ab236c93d1d6967f01cde49fc9528 to your computer and use it in GitHub Desktop.
在一个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