From fdcd2f192dd37ac2a2ea5b73926122009fbbe0aa Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Wed, 17 May 2017 20:39:47 +0900 Subject: Improve calc_read_size --- lib/gitlab/ci/trace/stream.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/gitlab/ci/trace/stream.rb b/lib/gitlab/ci/trace/stream.rb index e8c34f3da05..39826846be0 100644 --- a/lib/gitlab/ci/trace/stream.rb +++ b/lib/gitlab/ci/trace/stream.rb @@ -116,12 +116,8 @@ module Gitlab end def calc_read_size(pos, max) - if pos > max - BUFFER_SIZE + (pos - max) - else - remain = max - pos - (remain > BUFFER_SIZE) ? BUFFER_SIZE : remain - end + remain = max - pos + (remain > BUFFER_SIZE) ? BUFFER_SIZE : remain end end end -- cgit v1.2.1