feat: Add a job to clear notifications that were created before 1 month (#8732)
This commit is contained in:
8
app/jobs/notification/remove_old_notification_job.rb
Normal file
8
app/jobs/notification/remove_old_notification_job.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class Notification::RemoveOldNotificationJob < ApplicationJob
|
||||
queue_as :low
|
||||
|
||||
def perform
|
||||
Notification.where('created_at < ?', 1.month.ago)
|
||||
.find_each(batch_size: 1000, &:delete)
|
||||
end
|
||||
end
|
||||
@@ -19,5 +19,8 @@ class TriggerScheduledItemsJob < ApplicationJob
|
||||
|
||||
# Job to sync whatsapp templates
|
||||
Channels::Whatsapp::TemplatesSyncSchedulerJob.perform_later
|
||||
|
||||
# Job to clear notifications which are older than 1 month
|
||||
Notification::RemoveOldNotificationJob.perform_later
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user