summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-17 20:39:47 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-24 20:10:14 +0900
commitfdcd2f192dd37ac2a2ea5b73926122009fbbe0aa (patch)
tree79a412cbb09319198a4aadc7a641a9ec14e3e35b
parent8c1b07e0cc3e461939cae0a9566cbab172360cdf (diff)
downloadgitlab-ce-fdcd2f192dd37ac2a2ea5b73926122009fbbe0aa.tar.gz
Improve calc_read_size
-rw-r--r--lib/gitlab/ci/trace/stream.rb8
1 files 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