Ragunath V

Ragunath V

  • NA
  • 146
  • 13.9k

Task Factory Method with Delay

Aug 11 2015 6:08 AM
Hi,
 
am trying to call a particular Method with 5 mins Delay.below is my code.
 
try
{
HttpContext ctx = HttpContext.Current;
System.Threading.Tasks.Task.Factory.StartNew(() =>
{
HttpContext.Current = ctx;
System.Threading.Thread.Sleep(5 * 60 * 1000);
Sendafter5mins(param1,params2);
});
}
catch (Exception EX){
//Log Exception if any  
}
 
This Method is failing silently sometimes without any exception in log.
 
Please Suggest me is this the right way to fire a method with 5 mins delay. 
 

Answers (1)