fix logging

This commit is contained in:
vyzo 2020-10-26 15:19:09 +02:00
parent f26385d0c6
commit c0a039ee11

View File

@ -193,7 +193,7 @@ func (sm *syncManager) handlePeerHead(head peerHead) {
} }
func (sm *syncManager) handleWorkerStatus(status workerStatus) { func (sm *syncManager) handleWorkerStatus(status workerStatus) {
log.Debugf("worker %d done; status error: %s", status.err) log.Debugf("worker %d done; status error: %s", status.id, status.err)
sm.mx.Lock() sm.mx.Lock()
ws := sm.state[status.id] ws := sm.state[status.id]
@ -240,13 +240,11 @@ func (sm *syncManager) worker(ws *workerState) {
log.Infof("worker %d syncing in %s", ws.id, ws.ts) log.Infof("worker %d syncing in %s", ws.id, ws.ts)
start := build.Clock.Now() start := build.Clock.Now()
defer func() {
log.Infof("worker %d done; took %s", ws.id, build.Clock.Since(start))
}()
ctx := context.WithValue(sm.ctx, syncStateKey{}, ws.ss) ctx := context.WithValue(sm.ctx, syncStateKey{}, ws.ss)
err := sm.doSync(ctx, ws.ts) err := sm.doSync(ctx, ws.ts)
log.Infof("worker %d done; took %s", ws.id, build.Clock.Since(start))
select { select {
case sm.statusq <- workerStatus{id: ws.id, err: err}: case sm.statusq <- workerStatus{id: ws.id, err: err}:
case <-sm.ctx.Done(): case <-sm.ctx.Done():