-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(conductor)!: use HTTP to periodically poll Celestia heights #852
Conversation
919630f
to
fb789c4
Compare
fb789c4
to
23e1499
Compare
9ca74ae
to
e1c08f6
Compare
let mut interval = tokio::time::interval(poll_period); | ||
interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip); | ||
LatestHeightStream { | ||
inner: IntervalStream::new(interval).then(f), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did not know about this, very cool
.boxed() | ||
}); | ||
let mut interval = tokio::time::interval(poll_period); | ||
interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skipping is ok b/c conductor will fetch all blocks if a few heights are missed in the stream right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, so say the last block fetched is 10 and the latest celestia height we observed is 10 - in this case no new blocks will be fetched.
If the stream fails for 9 consecutive heights but then 10th one succeeds, then the latest observed height jumps from 10 to 20. In that moment the stream schedules 11 to 20 one after the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
…s in favor of periodic polling
e1c08f6
to
730e03a
Compare
Summary
Replaces the websocket subscription to get the latest Celestia heights by a HTTP fetch running periodically.
Background
Websocket adds complexity for questionable gain. Tests in particular are much more complex to set up, but also for normal operation disconnects and resubscriptions need to be handled explicitly because websocket does not have a reconnect mechanism.
This PR essentially comes full circle, removing every last trace of websocket again.
Changes
ASTRIA_CONDUCTOR_CELESTIA_NODE_WEBSOCKET_URL
configASTRIA_CONDUCTOR_CELESTIA_BLOCK_TIME_MS
config which takes an integer representing the duration in milliseconds between two successive Celestia block heights.Testing
Will be tested using blackbox tests and smoke tests (out of scope of this PR)
Breaking Changelist
ASTRIA_CONDUCTOR_CELESTIA_NODE_WEBSOCKET_URL
ASTRIA_CONDUCTOR_CELESTIA_BLOCK_TIME_MS