Commit 1b68149f authored by Igor Drozdov's avatar Igor Drozdov

Merge branch '216534-relaxed-force-mirror-update-restriction' into 'master'

Relax force pull mirror update restriction

Closes #216534

See merge request gitlab-org/gitlab!32075
parents 0ef4f320 067b2c06
...@@ -24,6 +24,8 @@ class StartPullMirroringService < BaseService ...@@ -24,6 +24,8 @@ class StartPullMirroringService < BaseService
private private
def update_now?(import_state) def update_now?(import_state)
import_state.last_update_at.nil? || import_state.last_update_at < INTERVAL.ago import_state.last_successful_update_at.nil? ||
import_state.last_update_at.nil? ||
import_state.last_update_at < INTERVAL.ago
end end
end end
---
title: Relax force pull mirror update restriction
merge_request: 32075
author:
type: fixed
...@@ -32,7 +32,7 @@ describe StartPullMirroringService do ...@@ -32,7 +32,7 @@ describe StartPullMirroringService do
context 'when project mirror has been updated in the last 5 minutes' do context 'when project mirror has been updated in the last 5 minutes' do
it 'schedules next execution' do it 'schedules next execution' do
Timecop.freeze(Time.current) do Timecop.freeze(Time.current) do
import_state.update(last_update_at: 3.minutes.ago) import_state.update(last_update_at: 3.minutes.ago, last_successful_update_at: 10.minutes.ago)
expect { execute } expect { execute }
.to change { import_state.next_execution_timestamp } .to change { import_state.next_execution_timestamp }
...@@ -44,7 +44,15 @@ describe StartPullMirroringService do ...@@ -44,7 +44,15 @@ describe StartPullMirroringService do
context 'when project mirror has been updated more than 5 minutes ago' do context 'when project mirror has been updated more than 5 minutes ago' do
before do before do
import_state.update(last_update_at: 6.minutes.ago) import_state.update(last_update_at: 6.minutes.ago, last_successful_update_at: 10.minutes.ago)
end
it_behaves_like 'force mirror update'
end
context 'when project mirror has been updated in the last 5 minutes but has never been successfully updated' do
before do
import_state.update(last_update_at: 3.minutes.ago, last_successful_update_at: nil)
end end
it_behaves_like 'force mirror update' it_behaves_like 'force mirror update'
......
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