debian-mirror-gitlab/app/services/clusters/agents/delete_expired_events_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
466 B
Ruby
Raw Normal View History

2022-03-02 08:16:31 +05:30
# 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