diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-03-06 17:54:32 +0200 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-03-06 17:54:32 +0200 |
commit | 1c10220fa8bb519c97e6aea1af9620ac38c8a285 (patch) | |
tree | a799a2fd40422c2a2af9ecc2a63655a2a826e619 /lib/api/helpers.rb | |
parent | 8452f94d44f8cc3ceb9b188e4a389a80e04f9eb4 (diff) | |
parent | 3137c0e409ed44d3623bebbd71ced3909af55c63 (diff) | |
download | gitlab-ci-1c10220fa8bb519c97e6aea1af9620ac38c8a285.tar.gz |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ci
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index fc19d76..58297a8 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -2,6 +2,7 @@ module API module Helpers PRIVATE_TOKEN_PARAM = :private_token PRIVATE_TOKEN_HEADER = "HTTP_PRIVATE_TOKEN" + UPDATE_RUNNER_EVERY = 60 def current_user @current_user ||= begin @@ -33,6 +34,12 @@ module API forbidden! unless project.valid_token?(params[:project_token]) end + def update_runner_last_contact + if current_runner.contacted_at.nil? || Time.now - current_runner.contacted_at >= UPDATE_RUNNER_EVERY + current_runner.update_attributes(contacted_at: Time.now) + end + end + # Checks the occurrences of required attributes, each attribute must be present in the params hash # or a Bad Request error is invoked. # |