2

I've read a lot of different values for how long a background task can run. Everything from 15 to 30 seconds. MSDN writes 25 seconds.

Does anyone know what the value is for sure? If the value is 25 seconds does it mean that I have 25 seconds to perform my tasks or does the task take some time to start and/or finish?

Jay
  • 56,361
  • 10
  • 99
  • 123
John
  • 681
  • 1
  • 8
  • 20

1 Answers1

0

MSDN seems like it's been updated, as I could swear that it was 15 seconds earlier this year. Anyway, I wouldn't concern myself, because if you can't do the operation in 15 seconds, you're likely to break the memory limit of 5 MB as well.

Also, the time is the execution time from when the ScheduledTaskAgent.OnInvoke is called.

Claus Jørgensen
  • 25,882
  • 9
  • 87
  • 150
  • The article says it was updated september 23. My code finishes in a second but my the HTTPWebRequest sometimes takes 20 seconds because of a slow/overloaded server and that is the my problem. Thats why it would be great to know for sure if I have 15 or 25 seconds. This is all so confusing :) – John Nov 19 '11 at 20:19
  • It's 25 if the documentation says so. If you don't believe the documentation, write a test :p – Claus Jørgensen Nov 19 '11 at 21:46
  • 2
    Either way, plan on using a timeout on the webrequest. If you cant finish it in ~15, bail early so you don't have your Agent failing all the time. – William Melani Nov 21 '11 at 05:12
  • Isn't sending a Toast Notification will help in your situation where you don't have to make an explicit webrequest ? – Tarek Khalil May 24 '12 at 15:07