Skip to content
Permalink
Browse files

Fix: pintrackers: Do not spam the logs when running recover

Currently logs every pin we call recover with. We call recover regularly.
So it will print all pins.
  • Loading branch information...
hsanjuan committed Aug 14, 2019
1 parent 5e4c8d9 commit 62b7054d31c92e6f520c25b5b15083d3f7f734e6
Showing with 4 additions and 2 deletions.
  1. +2 −1 pintracker/maptracker/maptracker.go
  2. +2 −1 pintracker/stateless/stateless.go
@@ -407,14 +407,15 @@ func (mpt *MapPinTracker) Recover(ctx context.Context, c cid.Cid) (*api.PinInfo,
ctx, span := trace.StartSpan(mpt.ctx, "tracker/map/Recover")
defer span.End()

logger.Infof("Attempting to recover %s", c)
pInfo := mpt.optracker.Get(ctx, c)
var err error

switch pInfo.Status {
case api.TrackerStatusPinError:
logger.Infof("Restarting pin operation for %s", c)
err = mpt.enqueue(ctx, api.PinCid(c), optracker.OperationPin, mpt.pinCh)
case api.TrackerStatusUnpinError:
logger.Infof("Restarting unpin operation for %s", c)
err = mpt.enqueue(ctx, api.PinCid(c), optracker.OperationUnpin, mpt.unpinCh)
}
return mpt.optracker.Get(ctx, c), err
@@ -516,7 +516,6 @@ func (spt *Tracker) Recover(ctx context.Context, c cid.Cid) (*api.PinInfo, error
ctx, span := trace.StartSpan(ctx, "tracker/stateless/Recover")
defer span.End()

logger.Infof("Attempting to recover %s", c)
pInfo, ok := spt.optracker.GetExists(ctx, c)
if !ok {
return spt.Status(ctx, c), nil
@@ -525,8 +524,10 @@ func (spt *Tracker) Recover(ctx context.Context, c cid.Cid) (*api.PinInfo, error
var err error
switch pInfo.Status {
case api.TrackerStatusPinError:
logger.Infof("Restarting pin operation for %s", c)
err = spt.enqueue(ctx, api.PinCid(c), optracker.OperationPin)
case api.TrackerStatusUnpinError:
logger.Infof("Restarting unpin operation for %s", c)
err = spt.enqueue(ctx, api.PinCid(c), optracker.OperationUnpin)
}
if err != nil {

0 comments on commit 62b7054

Please sign in to comment.
You can’t perform that action at this time.