pruner: log transitions to error state + log info to confirm pruning is done in active job

This commit is contained in:
Christian Schwarz 2018-10-19 15:58:04 +02:00
parent 359ab2ca0c
commit e63ac7d1bb
2 changed files with 17 additions and 0 deletions

View File

@ -356,6 +356,7 @@ func (j *ActiveSide) do(ctx context.Context) {
}) })
log.Info("start pruning sender") log.Info("start pruning sender")
tasks.prunerSender.Prune() tasks.prunerSender.Prune()
log.Info("finished pruning sender")
senderCancel() senderCancel()
} }
{ {
@ -371,6 +372,7 @@ func (j *ActiveSide) do(ctx context.Context) {
}) })
log.Info("start pruning receiver") log.Info("start pruning receiver")
tasks.prunerReceiver.Prune() tasks.prunerReceiver.Prune()
log.Info("finished pruning receiver")
receiverCancel() receiverCancel()
} }
} }

View File

@ -203,6 +203,12 @@ func (p *Pruner) prune(args args) {
GetLogger(args.ctx). GetLogger(args.ctx).
WithField("transition", fmt.Sprintf("%s=>%s", pre, post)). WithField("transition", fmt.Sprintf("%s=>%s", pre, post)).
Debug("state transition") Debug("state transition")
if err := p.Error(); err != nil {
GetLogger(args.ctx).
WithError(p.err).
WithField("state", post.String()).
Error("entering error state after error")
}
} }
} }
@ -262,6 +268,15 @@ func (p *Pruner) State() State {
return p.state return p.state
} }
func (p *Pruner) Error() error {
p.mtx.Lock()
defer p.mtx.Unlock()
if p.state & (PlanWait|ExecWait|ErrPerm) != 0 {
return p.err
}
return nil
}
type fs struct { type fs struct {
path string path string