diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-05-04 14:20:07 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-05-04 14:20:07 +0300 |
commit | 8fd76a752b2a67d1b0c15615be7a8b740e1ce082 (patch) | |
tree | ae093f6a303bd7e70ac791c699f4a529ce3f51f2 /app/models/ci/build_trace_chunk.rb | |
parent | 07375df12ee5820c8405ee2d23ea6980150e0d82 (diff) | |
parent | 8b47980e12887e255146ce155b446d9176586cfe (diff) |
Merge branch 'live-trace-v2' into live-trace-v2-efficient-destroy-all
Diffstat (limited to 'app/models/ci/build_trace_chunk.rb')
-rw-r--r-- | app/models/ci/build_trace_chunk.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/models/ci/build_trace_chunk.rb b/app/models/ci/build_trace_chunk.rb index 406b4f91ce7..2d21604325d 100644 --- a/app/models/ci/build_trace_chunk.rb +++ b/app/models/ci/build_trace_chunk.rb @@ -59,11 +59,14 @@ module Ci end def truncate(offset = 0) - self.append("", offset) if offset < size + raise ArgumentError, 'Offset is out of range' if offset > size || offset < 0 + return if offset == size # Skip the following process as it doesn't affect anything + + self.append("", offset) end def append(new_data, offset) - raise ArgumentError, 'Offset is out of range' if offset > data.bytesize || offset < 0 + raise ArgumentError, 'Offset is out of range' if offset > size || offset < 0 raise ArgumentError, 'Chunk size overflow' if CHUNK_SIZE < (offset + new_data.bytesize) set_data(data.byteslice(0, offset) + new_data) @@ -130,7 +133,7 @@ module Ci def schedule_to_db return if db? - BuildTraceChunkFlushToDbWorker.perform_async(id) + Ci::BuildTraceChunkFlushWorker.perform_async(id) end def fullfilled? |