From b07b8a5f3ed8383b7b3b37fc3f99c086ddc42e20 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 13 Apr 2017 22:07:37 +0800 Subject: [PATCH] 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 --- lib/gitlab/ci/trace/stream.rb | 8 +++----- 1 file 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)