We have an org that has hit:
System.AsyncException: You've exceeded the limit of 100 jobs in the flex queue
and are considering how to avoid that. (As this queue is a shared resource just waiting for the exception and then backing off seems anti-social to other apps that are using the queue; thinking of some kind of randomised back off when the queue is say half full. But is that over complicated?)
I see methods to move items in the queue but no convenient way to check how full the queue is.
Is it necessary to do a count
query the AsyncApexJob
object and if so are any specific where
terms needed? Or is there a method somewhere that returns the size of the queue without consuming the SOQL governor limit?