diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-04-13 22:07:37 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-04-13 22:07:37 +0800 |
commit | b07b8a5f3ed8383b7b3b37fc3f99c086ddc42e20 (patch) | |
tree | 4c65dfceb6f46be8e8c3b8a6863814480a7371ac | |
parent | ef33b7f388beb3be9063e2d23ee74dcb19aec217 (diff) | |
download | gitlab-ce-b07b8a5f3ed8383b7b3b37fc3f99c086ddc42e20.tar.gz |
Don't seek at all if the log is small anyway
then it's fine to skip the first line because
it won't be very noticeable
-rw-r--r-- | lib/gitlab/ci/trace/stream.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/gitlab/ci/trace/stream.rb b/lib/gitlab/ci/trace/stream.rb index 5e634bcac71..3b335cdfd01 100644 --- a/lib/gitlab/ci/trace/stream.rb +++ b/lib/gitlab/ci/trace/stream.rb @@ -25,12 +25,10 @@ module Gitlab end def limit(last_bytes = LIMIT_SIZE) - stream_size = size - if stream_size < last_bytes - last_bytes = stream_size + if last_bytes < size + stream.seek(-last_bytes, IO::SEEK_END) + stream.readline end - stream.seek(-last_bytes, IO::SEEK_END) - stream.readline end def append(data, offset) |