Use Members::AuthorizedDestroyService in RemoveExpiredMembersWorker.

This commit is contained in:
Adam Niedzielski 2016-08-04 23:35:28 +02:00
parent b4b51441aa
commit 8354810f10

View file

@ -2,9 +2,9 @@ class RemoveExpiredMembersWorker
include Sidekiq::Worker
def perform
Member.includes(:created_by).where("expires_at <= ?", Time.current).find_each do |member|
Member.where("expires_at <= ?", Time.current).find_each do |member|
begin
Members::DestroyService.new(member, member.created_by).execute
Members::AuthorizedDestroyService.new(member).execute
rescue => ex
logger.error("Expired Member ID=#{member.id} cannot be removed - #{ex}")
end