0

I'd like to write a function which does something, then before return something it triggers a function to be done after 30 minutes. I do not want to wait 30 minutes until another function will be done to return something from main function, how to do that?

[HttpPost]
public async Task<HttpResponseMessage> CreateEvent(FormDataCollection formData)
{
     //do something
     asyncFunction(30) - function to be done after 30 minutes (this function will probably have to have Thread.Sleep or something, not sure)
     return new HttpResponseMessage(HttpStatusCode.OK);
}

Is it possible in any way? I do not want to wait asyncFunction to be done to return HttpStatusCode.

ASh
  • 34,632
  • 9
  • 60
  • 82
Cezar
  • 345
  • 6
  • 18
  • Possible duplicate of [Best way to create a "run-once" time delayed function in C#](https://stackoverflow.com/questions/5904636/best-way-to-create-a-run-once-time-delayed-function-in-c-sharp) – ASh Oct 21 '17 at 11:21
  • look into [scheduled tasks] and particularly into [quartz.net](https://stackoverflow.com/tags/quartz.net/info) – ASh Oct 21 '17 at 11:25

0 Answers0