I have code that executes a SPROC that executes a SQL Scheduled Job.
The problem is that the scheduled job returns an error because it is already running.
Exception: executeCommandQuery SQLServerAgent Error: Request to run job XXXXXXXXXX (from User XXXXXXXXX) refused because the job is already running from a request by User XXXXXXXX
my question, is what is the best practice for this issue?
1. Is it a best practice to handle the error codes in the SPROC and to continue trying to start the scheduled job until it runs? If so, how do you know when to give up (just set up a time-out after so much time)?
2. Is it possible to configure the SQL Scheduled job such that it queues these requests up and I perhaps don't have this configured properly?
3. Is the best way to handle this in the code, such that I try a few times to start the sproc again and then have it time-out?