SharePoint - Timer Job Executing Multiple Times
A custom timer job ran once per content database on every cycle. Passing SPJobLockType.Job stops that.
Custom timer jobs inherit from SPJobDefinition, which lives in the Microsoft.SharePoint.Administration namespace.
I had a timer job scheduled to run every 5 minutes. After deployment it was invoked several times in each cycle - 10 times in my case, because the web application had 10 content databases. Use the SPJobLockType enumeration to avoid this.
csharp
public MyCustomTimerJob(string jobName, SPWebApplication webapp) :
base(jobName, webapp, null, SPJobLockType.Job)
{
this.Title = "My Custom Timer Job";
}
With SPJobLockType.Job only one instance of the job runs at a time, whatever the number of content databases.