Class: Gitlab::Ci::RunnerReleases

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/gitlab/ci/runner_releases.rb

Constant Summary collapse

RELEASES_VALIDITY_PERIOD =
1.day
RELEASES_VALIDITY_AFTER_ERROR_PERIOD =
5.seconds
INITIAL_BACKOFF =
5.seconds
MAX_BACKOFF =
1.hour
BACKOFF_GROWTH_FACTOR =
2.0

Instance Method Summary collapse

Constructor Details

#initializeRunnerReleases

Returns a new instance of RunnerReleases.


15
16
17
# File 'lib/gitlab/ci/runner_releases.rb', line 15

def initialize
  reset!
end

Instance Method Details

#releasesObject

Returns a sorted list of the publicly available GitLab Runner releases


21
22
23
24
25
# File 'lib/gitlab/ci/runner_releases.rb', line 21

def releases
  return @releases unless Time.now.utc >= @expire_time

  @releases = fetch_new_releases
end

#reset!Object


27
28
29
30
31
# File 'lib/gitlab/ci/runner_releases.rb', line 27

def reset!
  @expire_time = Time.now.utc
  @releases = nil
  @backoff_count = 0
end