Description
Description:
We are experiencing a significant issue with the Cap. The problem arises when the system attempts to delete expired messages. This operation frequently causes database locks, leading to performance degradation.
Current Behavior:
The following SQL query is used to delete expired messages in SQL Server:
(@timeout datetime, @batchCount int)
DELETE TOP (@batchCount)
FROM CRM.MessagingInbox WITH (readpast)
WHERE ExpiresAt < @timeout
AND (StatusName = 'Succeeded' OR StatusName = 'Failed');
This query often results in database locks.
Expected Behavior:
The system should be able to delete expired messages without causing significant database locks, ensuring smooth and efficient operation.
Proposed Solution:
We propose adding a configuration option to Cap that allows users to specify a time range during which expired messages can be deleted. For example, users could configure the system to delete expired messages only between 1 AM and 6 AM, thereby avoiding high load periods on the site.
Additional Context:
This issue is critical as it affects the overall performance and reliability.