Skip to content

Commit

Permalink
more efficient append bytes (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
Himer authored Apr 16, 2020
1 parent e51cd9f commit d31be9a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions inmem_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ func (m *InmemSnapshotStore) Open(id string) (*SnapshotMeta, io.ReadCloser, erro

// Write appends the given bytes to the snapshot contents
func (s *InmemSnapshotSink) Write(p []byte) (n int, err error) {
written, err := io.Copy(s.contents, bytes.NewReader(p))
s.meta.Size += written
return int(written), err
written, err := s.contents.Write(p)
s.meta.Size += int64(written)
return written, err
}

// Close updates the Size and is otherwise a no-op
Expand Down

0 comments on commit d31be9a

Please sign in to comment.