Merge pull request #2856 from cerasusland/unbind-post-waitgroup

submit wdpost proof without waitting for recovery and fault messages …
This commit is contained in:
Łukasz Magiera 2020-08-06 17:19:08 +02:00 committed by GitHub
commit bf9116c65a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,6 @@ import (
"bytes" "bytes"
"context" "context"
"errors" "errors"
"sync"
"time" "time"
"github.com/filecoin-project/go-bitfield" "github.com/filecoin-project/go-bitfield"
@ -283,31 +282,25 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di miner.DeadlineInfo
ctx, span := trace.StartSpan(ctx, "storage.runPost") ctx, span := trace.StartSpan(ctx, "storage.runPost")
defer span.End() defer span.End()
var declWait sync.WaitGroup
defer declWait.Wait()
declWait.Add(1)
go func() { go func() {
// TODO: extract from runPost, run on fault cutoff boundaries // TODO: extract from runPost, run on fault cutoff boundaries
defer declWait.Done()
// check faults / recoveries for the *next* deadline. It's already too // check faults / recoveries for the *next* deadline. It's already too
// late to declare them for this deadline // late to declare them for this deadline
declDeadline := (di.Index + 2) % miner.WPoStPeriodDeadlines declDeadline := (di.Index + 2) % miner.WPoStPeriodDeadlines
partitions, err := s.api.StateMinerPartitions(ctx, s.actor, declDeadline, ts.Key()) partitions, err := s.api.StateMinerPartitions(context.TODO(), s.actor, declDeadline, ts.Key())
if err != nil { if err != nil {
log.Errorf("getting partitions: %v", err) log.Errorf("getting partitions: %v", err)
return return
} }
if err := s.checkNextRecoveries(ctx, declDeadline, partitions); err != nil { if err := s.checkNextRecoveries(context.TODO(), declDeadline, partitions); err != nil {
// TODO: This is potentially quite bad, but not even trying to post when this fails is objectively worse // TODO: This is potentially quite bad, but not even trying to post when this fails is objectively worse
log.Errorf("checking sector recoveries: %v", err) log.Errorf("checking sector recoveries: %v", err)
} }
if err := s.checkNextFaults(ctx, declDeadline, partitions); err != nil { if err := s.checkNextFaults(context.TODO(), declDeadline, partitions); err != nil {
// TODO: This is also potentially really bad, but we try to post anyways // TODO: This is also potentially really bad, but we try to post anyways
log.Errorf("checking sector faults: %v", err) log.Errorf("checking sector faults: %v", err)
} }