Commit 38c10c05 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'dm-mirror-min-delay-30-minutes' into 'master'

Increase minimum mirror update interval from 15 to 30 minutes

See merge request gitlab-org/gitlab-ee!4959
parents 2fd81665 94823ff6
---
title: Increase minimum mirror update interval from 15 to 30 minutes
merge_request:
author:
type: other
...@@ -5,12 +5,13 @@ module Gitlab ...@@ -5,12 +5,13 @@ module Gitlab
PULL_CAPACITY_KEY = 'MIRROR_PULL_CAPACITY'.freeze PULL_CAPACITY_KEY = 'MIRROR_PULL_CAPACITY'.freeze
JITTER = 1.minute JITTER = 1.minute
# TODO: Make MIN_DELAY configurable and MAX_RETRY adjust according to it # TODO: Dynamically determine mirror update interval based on total number
# ISSUE: https://gitlab.com/gitlab-org/gitlab-ee/issues/3885 # of mirrors, average update time, and available concurrency.
# Issue: https://gitlab.com/gitlab-org/gitlab-ee/issues/5258
MIN_DELAY = 30.minutes
# MAX RETRY value was calculated based on the triangular number with a 15 minutes factor # MAX RETRY value was calculated based on the triangular number with a 15 minutes factor
# https://en.wikipedia.org/wiki/Triangular_number in order to make sure the mirror # https://en.wikipedia.org/wiki/Triangular_number in order to make sure the mirror
# gets retried for a full day before it becomes hard failed # gets retried for a full day before it becomes hard failed
MIN_DELAY = 15.minutes
MAX_RETRY = 14 MAX_RETRY = 14
class << self class << self
......
...@@ -193,7 +193,7 @@ describe Gitlab::Mirror do ...@@ -193,7 +193,7 @@ describe Gitlab::Mirror do
describe '#min_delay' do describe '#min_delay' do
it 'returns min delay with some jitter' do it 'returns min delay with some jitter' do
expect(described_class.min_delay).to be_within(1.minute).of(15.minutes) expect(described_class.min_delay).to be_within(1.minute).of(30.minutes)
end end
end end
end end
...@@ -50,12 +50,12 @@ describe ProjectMirrorData, type: :model do ...@@ -50,12 +50,12 @@ describe ProjectMirrorData, type: :model do
context 'when base delay is lower than mirror_max_delay' do context 'when base delay is lower than mirror_max_delay' do
before do before do
mirror_data.last_update_started_at = timestamp - 1.minute mirror_data.last_update_started_at = timestamp - 2.minutes
end end
context 'when retry count is 0' do context 'when retry count is 0' do
it 'applies transition successfully' do it 'applies transition successfully' do
expect_next_execution_timestamp(mirror_data, timestamp + 26.minutes) expect_next_execution_timestamp(mirror_data, timestamp + 52.minutes)
end end
end end
...@@ -64,7 +64,7 @@ describe ProjectMirrorData, type: :model do ...@@ -64,7 +64,7 @@ describe ProjectMirrorData, type: :model do
mirror_data.retry_count = 2 mirror_data.retry_count = 2
mirror_data.increment_retry_count mirror_data.increment_retry_count
expect_next_execution_timestamp(mirror_data, timestamp + 78.minutes) expect_next_execution_timestamp(mirror_data, timestamp + 156.minutes)
end end
end end
end end
...@@ -78,7 +78,7 @@ describe ProjectMirrorData, type: :model do ...@@ -78,7 +78,7 @@ describe ProjectMirrorData, type: :model do
context 'when last_update_started_at is nil' do context 'when last_update_started_at is nil' do
it 'applies transition successfully' do it 'applies transition successfully' do
expect_next_execution_timestamp(mirror_data, timestamp + 15.minutes + mirror_jitter) expect_next_execution_timestamp(mirror_data, timestamp + 30.minutes + mirror_jitter)
end end
end end
...@@ -89,7 +89,7 @@ describe ProjectMirrorData, type: :model do ...@@ -89,7 +89,7 @@ describe ProjectMirrorData, type: :model do
context 'when resetting retry count' do context 'when resetting retry count' do
it 'applies transition successfully' do it 'applies transition successfully' do
expect_next_execution_timestamp(mirror_data, timestamp + 15.minutes + mirror_jitter) expect_next_execution_timestamp(mirror_data, timestamp + 30.minutes + mirror_jitter)
end end
end end
...@@ -98,7 +98,7 @@ describe ProjectMirrorData, type: :model do ...@@ -98,7 +98,7 @@ describe ProjectMirrorData, type: :model do
mirror_data.retry_count = 3 mirror_data.retry_count = 3
mirror_data.increment_retry_count mirror_data.increment_retry_count
expect_next_execution_timestamp(mirror_data, timestamp + 62.minutes) expect_next_execution_timestamp(mirror_data, timestamp + 122.minutes)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment