Skip to content
Snippets Groups Projects
Commit 52994bb9 authored by Robert Speicher's avatar Robert Speicher Committed by Robert Speicher
Browse files

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
parent 38039e3a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -4,6 +4,10 @@ v 8.1.3
- Force update refs/merge-requests/X/head upon a push to the source branch of a merge request (Stan Hu)
 
v 8.1.2
v 8.1.3
- Spread out runner contacted_at updates
v 8.1.1
- Fix cloning Wiki repositories via HTTP (Stan Hu)
- Add migration to remove satellites directory
- Fix specific runners visibility
Loading
Loading
Loading
Loading
@@ -16,7 +16,9 @@ module Ci
end
 
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)
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment