Commit 94823ff6 authored by Douwe Maan's avatar Douwe Maan

Increase minimum mirror update interval from 15 to 30 minutes

parent f69f6a23
---
title: Increase minimum mirror update interval from 15 to 30 minutes
merge_request:
author:
type: other
......@@ -5,12 +5,13 @@ module Gitlab
PULL_CAPACITY_KEY = 'MIRROR_PULL_CAPACITY'.freeze
JITTER = 1.minute
# TODO: Make MIN_DELAY configurable and MAX_RETRY adjust according to it
# ISSUE: https://gitlab.com/gitlab-org/gitlab-ee/issues/3885
# TODO: Dynamically determine mirror update interval based on total number
# 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
# 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
MIN_DELAY = 15.minutes
MAX_RETRY = 14
class << self
......
......@@ -193,7 +193,7 @@ describe Gitlab::Mirror do
describe '#min_delay' 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
......@@ -50,12 +50,12 @@ describe ProjectMirrorData, type: :model do
context 'when base delay is lower than mirror_max_delay' do
before do
mirror_data.last_update_started_at = timestamp - 1.minute
mirror_data.last_update_started_at = timestamp - 2.minutes
end
context 'when retry count is 0' 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
......@@ -64,7 +64,7 @@ describe ProjectMirrorData, type: :model do
mirror_data.retry_count = 2
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
......@@ -78,7 +78,7 @@ describe ProjectMirrorData, type: :model do
context 'when last_update_started_at is nil' 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
......@@ -89,7 +89,7 @@ describe ProjectMirrorData, type: :model do
context 'when resetting retry count' 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
......@@ -98,7 +98,7 @@ describe ProjectMirrorData, type: :model do
mirror_data.retry_count = 3
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
......
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