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

delete_expired_events_service.rb « agents « clusters « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a0c0291c1fb659cb532ba390bb00e8c1fb347841 (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
# frozen_string_literal: true

module Clusters
  module Agents
    class DeleteExpiredEventsService
      def initialize(agent)
        @agent = agent
      end

      def execute
        agent.activity_events
          .recorded_before(remove_events_before)
          .each_batch { |batch| batch.delete_all }
      end

      private

      attr_reader :agent

      def remove_events_before
        agent.activity_event_deletion_cutoff
      end
    end
  end
end