Moved cleanup activities logic to activity bounded context. (#40663)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #38536 Split the activities cleanup job from the queries cleanup job. # Checklist for submitter - [ ] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. - Present in previous PR ## Testing - [x] Added/updated automated tests - [x] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Added automated cleanup job for expired live queries based on activity expiration settings. * **Improvements** * Refactored activity data cleanup to use a dedicated service for better reliability and maintainability. * Enhanced scheduled cleanup operations with improved separation of concerns for activity and live query management. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package api
|
||||
|
||||
import "context"
|
||||
|
||||
// CleanupExpiredActivitiesService cleans up expired activities.
|
||||
type CleanupExpiredActivitiesService interface {
|
||||
// CleanupExpiredActivities deletes up to maxCount activities older than expiryWindowDays
|
||||
// that are not linked to any host. Host-linked activities are preserved
|
||||
// (they are cleaned up when the host activity is processed).
|
||||
CleanupExpiredActivities(ctx context.Context, maxCount int, expiryWindowDays int) error
|
||||
}
|
||||
@@ -9,4 +9,5 @@ type Service interface {
|
||||
ListHostPastActivitiesService
|
||||
StreamActivitiesService
|
||||
NewActivityService
|
||||
CleanupExpiredActivitiesService
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user