SLA agent entries are piled up in PROD
A client had a production deployment planned this Sunday. After deployment we see that the SLA entries are piled up. Currently there are 890K entries in total.
Out of these entries 130K entries have pyminimumdatetimeforprocessing is past.
SLA agents are enabled on all nodes but still the count is not decreasing significantly.
The server was shutdown for around 18 hours for deployment.
Steps to Reproduce
Our flows have close to 20 assignments shape. After each assignment flow waits for a JMS response. Each assignment has an SLA. So in an order journey close to 30 assignments are present, so 30 SLA entries are created. After the work object is resolved the SLA entry remains as it is. It gets deleted only when the SLA picks it up and finds the corresponding assignment has been removed. Due to this there is a huge pile up of SLA entries
ResumeFlow retaining SLA entries when called using agent. QueueManager.deleteDeffered is not deleting sla entries from queue.
Changed step 21 of CompleteAssignment to use Database.deleteDeffered instead of QueueManager.deleteDeffered since QueueManager.deleteDeffered is not designed to delete queue entry of different class. It deletes entries of default class i.e., System-Queue-DefaultEntry.