在一个Action中执行耗时长且不关心返回值的方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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