Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-04-06 13:30:23 +0300
committerShinya Maeda <shinya@gitlab.com>2018-04-06 13:30:23 +0300
commitcffee49f7ffca39cb0e522dacc9b777e45d22680 (patch)
tree2158f7fa5bb5f0c3a278b837728e4b9f4a4d061c /lib/gitlab/ci/trace
parentaaff5e452ecfdcab3b76873da37b864109703b18 (diff)
Change Redis TTL to 1day. Fixing nitpicks
Diffstat (limited to 'lib/gitlab/ci/trace')
-rw-r--r--lib/gitlab/ci/trace/chunked_io.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/gitlab/ci/trace/chunked_io.rb b/lib/gitlab/ci/trace/chunked_io.rb
index d768c011968..8dbe892df64 100644
--- a/lib/gitlab/ci/trace/chunked_io.rb
+++ b/lib/gitlab/ci/trace/chunked_io.rb
@@ -19,7 +19,7 @@ module Gitlab
@job = job
@chunks_cache = []
@tell = 0
- @size = job_chunks.last.try(&:end_offset).to_i
+ @size = calculate_size
yield self if block_given?
end
@@ -48,7 +48,7 @@ module Gitlab
-1
end
- raise 'new position is outside of file' if new_pos < 0 || new_pos > size
+ raise ArgumentError, 'new position is outside of file' if new_pos < 0 || new_pos > size
@tell = new_pos
end
@@ -135,7 +135,7 @@ module Gitlab
end
def truncate(offset)
- raise 'Outside of file' if offset > size
+ raise ArgumentError, 'Outside of file' if offset > size
@tell = offset
@size = offset
@@ -221,6 +221,10 @@ module Gitlab
def job_chunks
::Ci::JobTraceChunk.where(job: job)
end
+
+ def calculate_size
+ job_chunks.order(chunk_index: :desc).last.try(&:end_offset).to_i
+ end
end
end
end