Last active
July 4, 2018 04:20
-
-
Save kiran-machhewar/cc6f0fd0d9e8d45ac34ceb5656c055e4 to your computer and use it in GitHub Desktop.
Analysis on Async Queues - SOQL, kill Async Jobs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
****** BEGIN --> APEX CLASS wise distribution ***** | |
SELECT ApexClass.Name, COUNT(ID) FROM AsyncApexJob WHERE Status = 'Queued' GROUP BY ApexClass.Name ORDER BY COUNT(ID) DESC | |
****** END --> APEX CLASS wise distribution ***** | |
****** BEGIN --> Kill Async Jobs ***** | |
for ( AsyncApexJob aJob : [ Select id ,Status, ApexClass.Name | |
from AsyncApexJob where Status='Queued' AND ApexClass.Name ='<ApexClassName>' LIMIT 150] ){ | |
System.AbortJob(aJob.Id); | |
} | |
****** BEGIN --> Kill Async Jobs ***** | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment