This repository has been archived by the owner on Jun 9, 2024. It is now read-only.
Fixed regression to 'File not ready yet' state #120
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue that causes octorpki to return the 'File not ready yet' state after previously achieving a stable state.
There are two functions that lead me to believe reverting to the 'File not ready yet' state is not the intended behavior of octorpki. In both
ServeROAs
andServeHealth
the code checks fors.Stable
ands.HasPreviousStable
, seemingly to continue serving ROAs if the state was once stable but isn't currently. The only places.HasPreviousStable
is set is immediately after s.Stable is set on octorpki.go#L1254 so whenevers.Stable
reverts to false afters.MainReduce()
so wills.HasPreviousStable
. Boths.Stable
ands.HasPreviousStable
being false will cause octorpki to revert to a state where no ROAs are served and instead a message is returned: 'File not ready yet'.s.Stable
is also set after the validation interval expires but that will result ins.HasPreviousStable
only being true for a single additional iteration, after which it may revert to false (based on the result ofs.MainReduce()
).The fix adds check to only set
s.HasPreviousStable
whens.Stable
is true.While I was making this change I also noticed that
s.HasPreviousStable
isn't set afterMaxIterations
is reached which similarly would result in the ROA list switching back and forth between available and 'File not ready yet'. I updated that to also sets.HasPreviousStable
.Happy to make any adjustments to this PR as needed. Please let me know if I'm misunderstanding the intended use of
s.HasPreviousStable
at all. Thanks!