feat: remove stale ONLINE_PRESENCE contact keys in redis (#9558)
50% of Redis memory size comes from ONLINE_PRESENCE keys. This PR adds a periodic job to remove stale keys from all accounts.
This commit is contained in:
11
app/jobs/internal/process_stale_redis_keys_job.rb
Normal file
11
app/jobs/internal/process_stale_redis_keys_job.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
# housekeeping
|
||||
# remove contact inboxes that does not have any conversations
|
||||
# and are older than 3 months
|
||||
|
||||
class Internal::ProcessStaleRedisKeysJob < ApplicationJob
|
||||
queue_as :low
|
||||
|
||||
def perform(account)
|
||||
Internal::RemoveStaleRedisKeysService.new(account_id: account.id).perform
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user