gitlab-org--gitlab-foss/app/models/concerns/runner_token_expiration_interval.rb

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

23 lines
667 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module RunnerTokenExpirationInterval
extend ActiveSupport::Concern
def enforced_runner_token_expiration_interval_human_readable
interval = enforced_runner_token_expiration_interval
ChronicDuration.output(interval, format: :short) if interval
end
def effective_runner_token_expiration_interval
[
enforced_runner_token_expiration_interval,
runner_token_expiration_interval&.seconds
].compact.min
end
def effective_runner_token_expiration_interval_human_readable
interval = effective_runner_token_expiration_interval
ChronicDuration.output(interval, format: :short) if interval
end
end