Merge pull request #1631 from ipfs/fix/recover-all

Bug fixing for v1.0.0-rc4
This commit is contained in:
Hector Sanjuan 2022-04-11 19:25:11 +02:00 committed by GitHub
commit 2827427be8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 11 deletions

View File

@ -1107,7 +1107,7 @@ func (ipfs *Connector) BlockStream(ctx context.Context, blocks <-chan api.NodeWi
break
}
if !it.Seen(res.Key) {
logger.Warnf("blockPut response CID (%s) does not match any blocks sent", res.Key)
logger.Debugf("blockPut response CID (%s) does not match any blocks sent", res.Key)
}
}
// continue until it.Done()

View File

@ -365,11 +365,12 @@ func (spt *Tracker) StatusAll(ctx context.Context, filter api.TrackerStatus, out
// Prepare pinset streaming
statePins := make(chan api.Pin, pinsChannelSize)
err = st.List(ctx, statePins)
if err != nil {
logger.Error(err)
return err
}
go func() {
err = st.List(ctx, statePins)
if err != nil {
logger.Error(err)
}
}()
// a shorthand for this select.
trySend := func(info api.PinInfo) bool {
@ -557,17 +558,19 @@ func (spt *Tracker) RecoverAll(ctx context.Context, out chan<- api.PinInfo) erro
defer span.End()
statusesCh := make(chan api.PinInfo, 1024)
err := spt.StatusAll(ctx, api.TrackerStatusUndefined, statusesCh)
if err != nil {
return err
}
go func() {
err := spt.StatusAll(ctx, api.TrackerStatusUndefined, statusesCh)
if err != nil {
logger.Error(err)
}
}()
for st := range statusesCh {
// Break out if we shutdown. We might be going through
// a very long list of statuses.
select {
case <-spt.ctx.Done():
err = fmt.Errorf("RecoverAll aborted: %w", ctx.Err())
err := fmt.Errorf("RecoverAll aborted: %w", ctx.Err())
logger.Error(err)
return err
default: