Merge pull request #7844 from llifezou/add_workerName_in_sealing_err

feat: #6147: Include worker name in sealing errors
This commit is contained in:
Łukasz Magiera 2022-03-02 13:13:34 +00:00 committed by GitHub
commit a6892f956e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
@ -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)