debian-mirror-gitlab/app/services/ci/stuck_builds/drop_scheduled_service.rb

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

24 lines
524 B
Ruby
Raw Normal View History

2021-11-18 22:05:49 +05:30
# frozen_string_literal: true
module Ci
module StuckBuilds
class DropScheduledService
include DropHelpers
BUILD_SCHEDULED_OUTDATED_TIMEOUT = 1.hour
def execute
Gitlab::AppLogger.info "#{self.class}: Cleaning scheduled, timed-out builds"
drop(scheduled_timed_out_builds, failure_reason: :stale_schedule)
end
private
def scheduled_timed_out_builds
Ci::Build.scheduled.scheduled_at_before(BUILD_SCHEDULED_OUTDATED_TIMEOUT.ago)
end
end
end
end