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
This commit is contained in:
Lin Jen-Shin 2017-04-13 22:07:37 +08:00
parent ef33b7f388
commit b07b8a5f3e
1 changed files with 3 additions and 5 deletions

View File

@ -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)