Commit 695a0c2e authored by Robert Speicher's avatar Robert Speicher

Merge branch 'dm-project-mirror-data-last_update_started_at-nil' into 'master'

Ensure mirror can transition out of the started state when last_update_started_at is nil

Closes #5008 and #5205

See merge request gitlab-org/gitlab-ee!4923
parents 13b64a9d 4937e12e
......@@ -39,6 +39,8 @@ class ProjectMirrorData < ActiveRecord::Base
private
def base_delay(timestamp)
return 0 unless self.last_update_started_at
duration = timestamp - self.last_update_started_at
(BACKOFF_PERIOD + rand(JITTER)) * duration.seconds
......
---
title: Ensure mirror can transition out of the started state when last_update_started_at
is nil
merge_request:
author:
type: fixed
......@@ -76,6 +76,12 @@ describe ProjectMirrorData, type: :model do
allow(Gitlab::Mirror).to receive(:rand).and_return(mirror_jitter)
end
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)
end
end
context 'when base delay is lower than mirror min_delay' do
before do
mirror_data.last_update_started_at = timestamp - 1.second
......
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