2018-06-27 07:23:28 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 18:09:10 +00:00
|
|
|
class RemoveExpiredGroupLinksWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 16:08:30 +00:00
|
|
|
include ApplicationWorker
|
2021-04-30 18:10:09 +00:00
|
|
|
|
2021-07-21 12:09:35 +00:00
|
|
|
data_consistency :always
|
|
|
|
|
2020-02-04 15:08:40 +00:00
|
|
|
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
|
2016-08-18 21:45:41 +00:00
|
|
|
|
2019-10-18 11:11:44 +00:00
|
|
|
feature_category :authentication_and_authorization
|
|
|
|
|
2016-08-18 21:45:41 +00:00
|
|
|
def perform
|
2020-06-03 06:08:34 +00:00
|
|
|
ProjectGroupLink.expired.find_each do |link|
|
|
|
|
Projects::GroupLinks::DestroyService.new(link.project, nil).execute(link)
|
|
|
|
end
|
2019-11-05 09:21:54 +00:00
|
|
|
|
|
|
|
GroupGroupLink.expired.find_in_batches do |link_batch|
|
2020-06-09 18:08:28 +00:00
|
|
|
Groups::GroupLinks::DestroyService.new(nil, nil).execute(link_batch, skip_authorization: true)
|
2019-11-05 09:21:54 +00:00
|
|
|
end
|
2016-08-18 21:45:41 +00:00
|
|
|
end
|
|
|
|
end
|