January 9, 2012 at 9:40 am
I have a job scheduled to run every minute. What I find is that if the job completes within 54 seconds, it will start again the following minute (as expected). But if it has a duration of 55 through 59 seconds, it does not start and will wait a further full minute. So instead of the job running once per minute, you get something like the following pattern for a job that takes 57 seconds (times are in hh:mm:ss):
Starts: 01:00:00 Ends 01:00:57
Starts: 01:02:00 Ends 01:02:57
Starts: 01:04:00 Ends 01:04:57
Starts: 01:06:00 Ends 01:06:57
What I would have expected was:
Starts: 01:00:00 Ends 01:00:57
Starts: 01:01:00 Ends 01:01:57
Starts: 01:02:00 Ends 01:02:57
Starts: 01:03:00 Ends 01:03:57
So, the job is effectively running every two minutes. I do understand that the next iteration of the job won't start if the job is still currently running, but in this case, it stopped running three seconds ago. It's almost as if the writing of the job status is (very) lazy and the agent thinks it is still running for a good few seconds after its completion.
This is easy to replicate with a simple sql job with the appropriate WAITFOR DELAY. The same thing happens with any other schedule I have chosen (i.e. if the job completes withing 5 seconds of the next iteration, there will be a gap).
Does anyone have any experience with this problem? Any tips or tricks to work around it?
January 9, 2012 at 10:31 am
Probably not the best solution, but you could create 2 jobs, scheduled to alternate every 2 minutes. Curious to see what others say as far as an explanation.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply