Add support for content labels on commit
Add commit options which allow for setting labels on commit. Prevents potential race between garbage collector reading labels after commit and labels getting set. Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
@@ -420,7 +420,11 @@ func (s *Service) Write(session api.Content_WriteServer) (err error) {
|
||||
}
|
||||
|
||||
if req.Action == api.WriteActionCommit {
|
||||
if err := wr.Commit(total, expected); err != nil {
|
||||
var opts []content.Opt
|
||||
if req.Labels != nil {
|
||||
opts = append(opts, content.WithLabels(req.Labels))
|
||||
}
|
||||
if err := wr.Commit(total, expected, opts...); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user