Merge branch 'spread-runner-last-updated-at' into 'master'
Spread out runner contacted_at updates This is meant to prevent having too many concurrent UPDATE requests caused by runners checking in. See merge request !1722
This commit is contained in:
commit
cc40c7af4d
|
@ -23,6 +23,9 @@ v 8.2.0 (unreleased)
|
||||||
- Add "added", "modified" and "removed" properties to commit object in webhook
|
- Add "added", "modified" and "removed" properties to commit object in webhook
|
||||||
- Rename "Back to" links to "Go to" because its not always a case it point to place user come from
|
- Rename "Back to" links to "Go to" because its not always a case it point to place user come from
|
||||||
|
|
||||||
|
v 8.1.3
|
||||||
|
- Spread out runner contacted_at updates
|
||||||
|
|
||||||
v 8.1.1
|
v 8.1.1
|
||||||
- Fix cloning Wiki repositories via HTTP (Stan Hu)
|
- Fix cloning Wiki repositories via HTTP (Stan Hu)
|
||||||
- Add migration to remove satellites directory
|
- Add migration to remove satellites directory
|
||||||
|
|
|
@ -16,7 +16,9 @@ module Ci
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_runner_last_contact
|
def update_runner_last_contact
|
||||||
if current_runner.contacted_at.nil? || Time.now - current_runner.contacted_at >= UPDATE_RUNNER_EVERY
|
# Use a random threshold to prevent beating DB updates
|
||||||
|
contacted_at_max_age = UPDATE_RUNNER_EVERY + Random.rand(UPDATE_RUNNER_EVERY)
|
||||||
|
if current_runner.contacted_at.nil? || Time.now - current_runner.contacted_at >= contacted_at_max_age
|
||||||
current_runner.update_attributes(contacted_at: Time.now)
|
current_runner.update_attributes(contacted_at: Time.now)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue