diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2018-05-28 14:58:23 +0200 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2018-05-29 12:51:32 +0200 |
commit | 61ea2f52bd32d5038b9eec1caf29a4d4531d03c4 (patch) | |
tree | fdc5782c18c2150fa119c3ee8c89a36d0ef45d62 /app/models/event.rb | |
parent | 71dea693c61295c16cb9c28c76b1122a3b8a3acf (diff) | |
download | gitlab-ce-61ea2f52bd32d5038b9eec1caf29a4d4531d03c4.tar.gz |
Throttle updates to Project#last_repository_updated_at.
Closes #35364.
Diffstat (limited to 'app/models/event.rb')
-rw-r--r-- | app/models/event.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/event.rb b/app/models/event.rb index 741a84194e2..ac0b1c7b27c 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -40,6 +40,7 @@ class Event < ActiveRecord::Base ).freeze RESET_PROJECT_ACTIVITY_INTERVAL = 1.hour + REPOSITORY_UPDATED_AT_INTERVAL = 5.minutes delegate :name, :email, :public_email, :username, to: :author, prefix: true, allow_nil: true delegate :title, to: :issue, prefix: true, allow_nil: true @@ -391,6 +392,7 @@ class Event < ActiveRecord::Base def set_last_repository_updated_at Project.unscoped.where(id: project_id) + .where("last_repository_updated_at < ? OR last_repository_updated_at IS NULL", REPOSITORY_UPDATED_AT_INTERVAL.ago) .update_all(last_repository_updated_at: created_at) end |