Welcome to mirror list, hosted at ThFree Co, Russian Federation.

clear_groups_issue_counter_worker.rb « issuables « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a8d6fd2f870aaf77928a312900c3351a1de74ebf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

module Issuables
  class ClearGroupsIssueCounterWorker
    include ApplicationWorker

    idempotent!
    urgency :low
    feature_category :issue_tracking

    def perform(group_ids = [])
      return if group_ids.empty?

      groups_with_ancestors = Gitlab::ObjectHierarchy
        .new(Group.by_id(group_ids))
        .base_and_ancestors

      clear_cached_count(groups_with_ancestors)
    end

    private

    def clear_cached_count(groups)
      groups.each do |group|
        Groups::OpenIssuesCountService.new(group).clear_all_cache_keys
      end
    end
  end
end