Skip to content

Commit

Permalink
Delay static manifest until our head is within the target period
Browse files Browse the repository at this point in the history
Unfortunately, due to
filecoin-project/lotus#12557, time in our
lotus tests is basically broken. So we start by relying on time but also
check the head so we don't switch too early.

This doesn't matter in practice, but I'd really like to be able to test
this in CI, fully integrated.
  • Loading branch information
Stebalien committed Oct 4, 2024
1 parent 2731818 commit 0a3aa14
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions manifest/fusing_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,30 @@ func (m *FusingManifestProvider) Start(ctx context.Context) error {
for m.runningCtx.Err() == nil {
select {
case <-timer.C:
// Make sure we're actually at the target epoch. This shouldn't be
// an issue unless our clocks are really funky, the network is
// behind, or we're in a lotus integration test
// (https://github.com/filecoin-project/lotus/issues/12557).
head, err := m.ec.GetHead(m.runningCtx)
switch {
case err != nil:
log.Errorw("failed to get head in fusing manifest provider", "error", err)
fallthrough
case head.Epoch() < switchEpoch:
log.Infow("delaying fusing manifest switch-over because head is behind the target epoch",
"head", head.Epoch(),
"target epoch", switchEpoch,
"bootstrap epoch", m.static.BootstrapEpoch,
)
timer.Reset(m.static.EC.Period)
continue

Check warning on line 109 in manifest/fusing_provider.go

View check run for this annotation

Codecov / codecov/patch

manifest/fusing_provider.go#L99-L109

Added lines #L99 - L109 were not covered by tests
}

log.Infow(
"fusing to the static manifest, stopping the dynamic manifest provider",
"network", m.static.NetworkName,
"bootstrap epoch", m.static.BootstrapEpoch,
"current epoch", head.Epoch(),
)
m.updateManifest(m.static)
// Log any errors and move on. We don't bubble it because we don't
Expand Down

0 comments on commit 0a3aa14

Please sign in to comment.