Skip to content

Adding a Configuration Item to Specify a Time Range When Purging Expired Messages #1613

Closed as not planned
@hamedzsmm

Description

@hamedzsmm

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions