From ec46aca820bbddd230375d9f649059ff1b1a4562 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 1 Jul 2015 00:33:45 +0200 Subject: [PATCH] Improved cleanup. --- app/models/online_notification.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/online_notification.rb b/app/models/online_notification.rb index 808c93457..9b48f0150 100644 --- a/app/models/online_notification.rb +++ b/app/models/online_notification.rb @@ -199,7 +199,7 @@ cleanup old online notifications def self.cleanup OnlineNotification.where('created_at < ?', Time.zone.now - 12.months).delete_all - OnlineNotification.where('seen = ? AND created_at < ?', true, Time.zone.now - 4.months).delete_all + OnlineNotification.where('seen = ? AND created_at < ?', true, Time.zone.now - 2.days).delete_all # notify all agents users = Ticket::ScreenOptions.agents @@ -211,6 +211,7 @@ cleanup old online notifications data: {} } ) + sleep 2 # slow down client requests } true