2

Given that the limit on the Apex Flex Queue is 100, what happens when it is time for the system to execute a Scheduled Job (of a Database.Batchable), but the Apex Flex Queue is maxed out at 100? Is there some platform magic that will make certain the scheduled job is run when resources are available, or does the Scheduled Job simply fail? This does not seem to be documented.

Thank you.

  • if the flex Queue exceed 100 then you will receive System.AsyncException: You have exceeded the maximum number (100) of Apex scheduled jobs. error. – Ratan Paul Jan 11 '16 at 9:09
  • @Ratan thank you very much. We will catch this and react accordingly. – Pittsburgh DBA Jan 11 '16 at 15:26
3

If the job does not call a batch job, it will run normally (assuming resources are available); it may run later than specified, but it will still run. If the scheduleable class calls asynchronous code, then it will fail, so your scheduled job would need to try later. This is now a catchable exception, so you could choose to reschedule earlier than usual if you want a chance to run your batch again after a few minutes.

  • Thank you! Is it a LimitException or something different? This code will definitely call a Batchable class (I will amend the question to clarify this). I wish the docs would keep up. – Pittsburgh DBA Jan 11 '16 at 14:17
  • I found it by just overwhelming the Flex Queue. It is System.AsyncException. Thank you very much! This is a great thing to have. – Pittsburgh DBA Jan 11 '16 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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