Skip to content

Commit

Permalink
explicitly abort PoSt on context cancellation
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Oct 30, 2020
1 parent 6985af5 commit 077bc83
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions storage/wdpost_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,15 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty

log.Warnw("generate window post skipped sectors", "sectors", ps, "error", err, "try", retries)

// Explicitly make sure we haven't aborted this PoSt
// (GenerateWindowPoSt may or may not check this).
// Otherwise, we could try to continue proving a
// deadline after the deadline has ended.
if ctx.Err() != nil {
log.Warnw("aborting PoSt due to context cancellation", "error", ctx.Err(), "deadline", di.Index)
return nil, ctx.Err()
}

skipCount += uint64(len(ps))
for _, sector := range ps {
postSkipped.Set(uint64(sector.Number))
Expand Down

1 comment on commit 077bc83

@hyunmoon
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!
Today I ran into the very problem this commit will fix.
wd2

Please sign in to comment.