2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 13:09:10 -05:00
|
|
|
class RemoveExpiredMembersWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2020-02-04 10:08:40 -05:00
|
|
|
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
|
2016-08-04 03:41:29 -04:00
|
|
|
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category :authentication_and_authorization
|
2019-10-30 11:14:17 -04:00
|
|
|
worker_resource_boundary :cpu
|
2019-10-18 07:11:44 -04:00
|
|
|
|
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
|