I have a scheduled class that I have set to run every 2 mins to check for updates from a third party system.
This had been working fine for months but lately the scheduled class is getting stuck in a status of queued.
The methods of the class are:
global void execute(SchedulableContext SC) {
tokenCheckCrossNI();
tokenCheckCross();
FAChangesSchedule.start();
// abort me and start again
System.abortJob( SC.getTriggerId() );
}
public static void start(){
// start keepalive again in 2 mins
Datetime sysTime = System.now().addSeconds(120);
String chronExpression = '' + sysTime.second() + ' ' + sysTime.minute() + ' ' + sysTime.hour() + ' ' + sysTime.day() + ' ' + sysTime.month() + ' ? ' + sysTime.year();
System.schedule( 'FAChangesSchedule ' + sysTime, chronExpression, new FAChangesSchedule() );
}
I have checked the logs for this class and can't see any errors:
Could the running order of the methods within this class be causing this issue?
Is there anything I can do to get around this hanging? Or somewhere I can check why this is stuck in the queue?