2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-04 03:41:29 -04:00
|
|
|
class RemoveExpiredMembersWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2016-10-21 12:13:41 -04:00
|
|
|
include CronjobQueue
|
2016-08-04 03:41:29 -04:00
|
|
|
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category :authentication_and_authorization
|
|
|
|
|
2016-08-04 03:41:29 -04:00
|
|
|
def perform
|
2016-08-09 12:39:13 -04:00
|
|
|
Member.expired.find_each do |member|
|
2019-03-13 09:42:43 -04:00
|
|
|
Members::DestroyService.new.execute(member, skip_authorization: true)
|
|
|
|
rescue => ex
|
|
|
|
logger.error("Expired Member ID=#{member.id} cannot be removed - #{ex}")
|
2016-08-04 03:41:29 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|