chore: rubocop fix
This commit is contained in:
parent
2d36d3879d
commit
10d0eb063f
1 changed files with 2 additions and 3 deletions
|
@ -10,11 +10,10 @@ class Migration::RemoveStaleNotificationsJob < ApplicationJob
|
||||||
|
|
||||||
def remove_invalid_messages
|
def remove_invalid_messages
|
||||||
deleted_ids = []
|
deleted_ids = []
|
||||||
Message.pluck(:inbox_id).uniq.each_slice(1000) do |id_list|
|
Message.distinct.pluck(:inbox_id).each_slice(1000) do |id_list|
|
||||||
deleted_ids << (id_list - Inbox.where(id: id_list).pluck(:id))
|
deleted_ids << (id_list - Inbox.where(id: id_list).pluck(:id))
|
||||||
end
|
end
|
||||||
|
|
||||||
Message.where(inbox_id: deleted_ids.flatten).destroy_all
|
Message.where(inbox_id: deleted_ids.flatten).destroy_all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue