Skip to content

Commit

Permalink
Do not fail if a share is already in the index
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Jun 1, 2022
1 parent 401c6bb commit 0d0fc81
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/share/manager/cs3/cs3.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/cs3org/reva/v2/pkg/share"
"github.com/cs3org/reva/v2/pkg/share/manager/registry"
"github.com/cs3org/reva/v2/pkg/storage/utils/indexer"
indexerErrors "github.com/cs3org/reva/v2/pkg/storage/utils/indexer/errors"
"github.com/cs3org/reva/v2/pkg/storage/utils/indexer/option"
"github.com/cs3org/reva/v2/pkg/storage/utils/metadata"
"github.com/cs3org/reva/v2/pkg/utils"
Expand Down Expand Up @@ -187,7 +188,7 @@ func (m *Manager) Load(shareChan <-chan *collaboration.Share, receivedShareChan
if s.ReceivedShare != nil && s.UserId != nil {
fmt.Println("Loading received share", s.ReceivedShare.Share.Id)
if err := m.persistReceivedShare(context.Background(), s.UserId, s.ReceivedShare); err != nil {
fmt.Println("error persisting share:", s, err)
fmt.Println("error persisting received share:", s, err)
}
}
}
Expand Down Expand Up @@ -241,6 +242,9 @@ func (m *Manager) persistShare(ctx context.Context, share *collaboration.Share)
}

_, err = m.indexer.Add(share)
if _, ok := err.(*indexerErrors.AlreadyExistsErr); ok {
return nil
}
return err
}

Expand Down

0 comments on commit 0d0fc81

Please sign in to comment.