Skip to content

Commit

Permalink
Merge pull request #7844 from llifezou/add_workerName_in_sealing_err
Browse files Browse the repository at this point in the history
feat: #6147: Include worker name in sealing errors
  • Loading branch information
magik6k authored Mar 2, 2022
2 parents c018dac + dac5518 commit a6892f9
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion extern/sector-storage/worker_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,13 @@ func newLocalWorker(executor ExecutorFunc, wcfg WorkerConfig, envLookup EnvFunc,

go func() {
for _, call := range unfinished {
err := storiface.Err(storiface.ErrTempWorkerRestart, xerrors.New("worker restarted"))
hostname, osErr := os.Hostname()
if osErr != nil {
log.Errorf("get hostname err: %+v", err)
hostname = ""
}

err := storiface.Err(storiface.ErrTempWorkerRestart, xerrors.Errorf("worker [Hostname: %s] restarted", hostname))

// TODO: Handle restarting PC1 once support is merged

Expand Down Expand Up @@ -263,6 +269,15 @@ func (l *LocalWorker) asyncCall(ctx context.Context, sector storage.SectorRef, r
}
}

if err != nil {
hostname, osErr := os.Hostname()
if osErr != nil {
log.Errorf("get hostname err: %+v", err)
}

err = xerrors.Errorf("%w [Hostname: %s]", err.Error(), hostname)
}

if doReturn(ctx, rt, ci, l.ret, res, toCallError(err)) {
if err := l.ct.onReturned(ci); err != nil {
log.Errorf("tracking call (done): %+v", err)
Expand Down

0 comments on commit a6892f9

Please sign in to comment.