From 9753a7d2882d7c8efce7b63674f36d78ae3edafb Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Wed, 26 Jun 2019 09:07:44 +0700 Subject: [PATCH] Set higher TTL to write lock for traces Set higher TTL is safer option when it comes to long running archive --- changelogs/unreleased/set-higher-ttl-for-trace-write.yml | 5 +++++ lib/gitlab/ci/trace.rb | 2 +- spec/support/shared_examples/ci_trace_shared_examples.rb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/set-higher-ttl-for-trace-write.yml diff --git a/changelogs/unreleased/set-higher-ttl-for-trace-write.yml b/changelogs/unreleased/set-higher-ttl-for-trace-write.yml new file mode 100644 index 00000000000..9f17172100c --- /dev/null +++ b/changelogs/unreleased/set-higher-ttl-for-trace-write.yml @@ -0,0 +1,5 @@ +--- +title: Set higher TTL for write lock of trace to prevent concurrent archiving +merge_request: 30064 +author: +type: fixed diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb index dfae260239e..ce5857965bf 100644 --- a/lib/gitlab/ci/trace.rb +++ b/lib/gitlab/ci/trace.rb @@ -5,7 +5,7 @@ module Gitlab class Trace include ::Gitlab::ExclusiveLeaseHelpers - LOCK_TTL = 1.minute + LOCK_TTL = 10.minutes LOCK_RETRIES = 2 LOCK_SLEEP = 0.001.seconds diff --git a/spec/support/shared_examples/ci_trace_shared_examples.rb b/spec/support/shared_examples/ci_trace_shared_examples.rb index f985b2dcbba..ab0550e2613 100644 --- a/spec/support/shared_examples/ci_trace_shared_examples.rb +++ b/spec/support/shared_examples/ci_trace_shared_examples.rb @@ -270,7 +270,7 @@ shared_examples_for 'common trace features' do include ExclusiveLeaseHelpers before do - stub_exclusive_lease_taken("trace:write:lock:#{trace.job.id}", timeout: 1.minute) + stub_exclusive_lease_taken("trace:write:lock:#{trace.job.id}", timeout: 10.minutes) end it 'blocks concurrent archiving' do