10

I have a timer job that invokes a WCF service that invokes a single threaded API internally.

TO ensure that my system does not fail, i want to ensure that only a single instance runs at a time.

I am setting SPJobLockType.Job t ensure this.

My concern is, what happens when the timer job schedule is too frequent? What happens when an old instance of the timer job is still running when the new instance is scheduled to run?

Will the new instance of the timer job just defer its execution? or does it abort itself? Or does it abort the old version?

In general, what are the best practices to ensure that my above described scenario runs without any failures?

1
  • Have I answered your question?
    – Mike
    Commented Aug 2, 2012 at 17:40

2 Answers 2

4

Jobs that are already running take priority, and new jobs that want to take over will fail. In order to ensure the new job to run, the old job must finish or be aborted.

What does your timer job do exactly? If there are database transactions or file movement, I would say to avoid the abortion of the job if you can help it.

0

The lock type that you have chosen will basically block any other jobs from running until your currently executing job has completed.

So you have two options:

  • Boost the server performance to ensure that your timer job will always finish on time (costly)
  • Choose an appropriate schedule interval to minimise the risk of this type of clash.

It really does depend upon the operation that is being performed by the job and the impact of a scheduled job being missed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.