Skip to content

Commit

Permalink
[libbeat] Fix position writing in the disk queue
Browse files Browse the repository at this point in the history
  • Loading branch information
faec authored Sep 29, 2020
1 parent e6c3d89 commit bb84f3f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions libbeat/publisher/queue/diskqueue/state_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ func writeQueuePositionToHandle(
}

// Want to write: version (0), segment id, segment offset.
elems := []interface{}{uint32(0), position.segmentID, position.offset}
for _, elem := range elems {
err = binary.Write(file, binary.LittleEndian, &elem)
if err != nil {
return err
}
err = binary.Write(file, binary.LittleEndian, uint32(0))
if err != nil {
return err
}
err = binary.Write(file, binary.LittleEndian, position.segmentID)
if err != nil {
return err
}
return nil
err = binary.Write(file, binary.LittleEndian, position.offset)
return err
}

0 comments on commit bb84f3f

Please sign in to comment.