diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2019-07-19 18:28:23 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2019-07-23 17:04:49 +0300 |
commit | ab11eee1d6e3881399b671f0ebe857a085321371 (patch) | |
tree | 83796b071d0e622e076b52f8b97a2931745a7c42 /spec/models | |
parent | 31335ea661ea27d7bed3990346f63aabcc2140a5 (diff) |
Mark mirrors as failed 1 hour after they started
We call `Project#mark_stuck_remote_mirrors_as_failed!` from the
`Git::BaseHooksService`. So that gets called every time we push tags
or branches.
Before this would only mark started mirrors as failed if they had
been started 24 hours ago. A push would never take 24 hours,
especially not when we run it so often.
Lowering that threshold 1 hour should at least allow us to retry
broken mirrors more often on pushes.
The timeout for the initial push is set somewhat longer to accommodate
for pushing large repos. Both numbers are currently picked arbitrarily.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/remote_mirror_spec.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/spec/models/remote_mirror_spec.rb b/spec/models/remote_mirror_spec.rb index e14b19db915..687b0935c55 100644 --- a/spec/models/remote_mirror_spec.rb +++ b/spec/models/remote_mirror_spec.rb @@ -113,7 +113,7 @@ describe RemoteMirror, :mailer do remote_mirror = create(:remote_mirror) - expect(remote_mirror.remote_name).to eq("remote_mirror_secret") + expect(remote_mirror.remote_name).to eq('remote_mirror_secret') end end @@ -201,11 +201,20 @@ describe RemoteMirror, :mailer do end context 'stuck mirrors' do - it 'includes mirrors stuck in started with no last_update_at set' do + it 'includes mirrors that were started over an hour ago' do + mirror = create_mirror(url: 'http://cantbeblank', + update_status: 'started', + last_update_at: 3.hours.ago, + updated_at: 2.hours.ago) + + expect(described_class.stuck.last).to eq(mirror) + end + + it 'includes mirrors started over 3 hours ago for their first sync' do mirror = create_mirror(url: 'http://cantbeblank', update_status: 'started', last_update_at: nil, - updated_at: 25.hours.ago) + updated_at: 4.hours.ago) expect(described_class.stuck.last).to eq(mirror) end |