[#45] object/search: Fix double write of local result

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-09-30 17:18:17 +03:00 committed by Alex Vanin
parent 08b9ae547a
commit 39ddb3a3f4

View file

@ -26,8 +26,6 @@ type searchQueryFilter struct {
}
func (s *localStream) stream(ctx context.Context, ch chan<- []*objectSDK.ID) error {
idList := make([]*objectSDK.ID, 0)
filter := &searchQueryFilter{
query: s.query,
ch: ch,
@ -38,16 +36,12 @@ func (s *localStream) stream(ctx context.Context, ch chan<- []*objectSDK.ID) err
case <-ctx.Done():
return true
default:
idList = append(idList, meta.Head().GetID())
return false
}
}); err != nil && !errors.Is(errors.Cause(err), bucket.ErrIteratingAborted) {
return errors.Wrapf(err, "(%T) could not iterate over local storage", s)
}
ch <- idList
return nil
}