The system has batch call out APEX classes to sync Salesforce information with another Email sending provider, Active Campaign. Every time we insert or update a custom lead or custom opportunity, the system will call out the batch classes to communicate with Active Campaign so we can send proper emails to our customers.
Everyday we have a plenty of records to change on Lead and Opportunity. Occasionally, the system reaches the 100 limit for Apex Flex Queue. Therefore, I modified the code when the 100 limit for Apex Flex Queue has been reached, new tasks will be scheduled in Scheduled Jobs. However, today both the Apex Flex Queue and the Scheduled jobs limit have been reached, which means at the backend Salesforce queued 200 tasks in the system.
I would like to know whether there are people who have experienced the same situation and how they solved this problem. I believe the code has been optimised to its maximum capacity, but if you want to see my code, please tell me. One of the reasons I do not put my code here is that there are four batch classes and three triggers to execute the whole process. There would be too much to put on the forum.