Respect context
This commit is contained in:
parent
6dee0d8ca8
commit
c902218baf
@ -226,12 +226,19 @@ func (m *Sealing) handleWaitMutable(ctx statemachine.Context, sector SectorInfo)
|
|||||||
// Sleep for immutable epochs
|
// Sleep for immutable epochs
|
||||||
if immutable {
|
if immutable {
|
||||||
dlineEpochsRemaining := dlinfo.NextOpen() - ts.Height()
|
dlineEpochsRemaining := dlinfo.NextOpen() - ts.Height()
|
||||||
|
waitTime := time.Duration(0)
|
||||||
if sectorDeadlineOpen {
|
if sectorDeadlineOpen {
|
||||||
// sleep for remainder of deadline
|
// sleep for remainder of deadline
|
||||||
time.Sleep(time.Duration(build.BlockDelaySecs) * time.Second * time.Duration(dlineEpochsRemaining))
|
waitTime = time.Duration(build.BlockDelaySecs) * time.Second * time.Duration(dlineEpochsRemaining)
|
||||||
} else {
|
} else {
|
||||||
// sleep for remainder of deadline and next one
|
// sleep for remainder of deadline and next one
|
||||||
time.Sleep(time.Duration(build.BlockDelaySecs) * time.Second * time.Duration(dlineEpochsRemaining+dlinfo.WPoStChallengeWindow))
|
waitTime = time.Duration(build.BlockDelaySecs) * time.Second * time.Duration(dlineEpochsRemaining+dlinfo.WPoStChallengeWindow)
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-time.After(waitTime):
|
||||||
|
case <-ctx.Context().Done():
|
||||||
|
return ctx.Context().Err()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user