-
Notifications
You must be signed in to change notification settings - Fork 221
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
UI feedback of state machine #1880
Conversation
a56db65
to
d5b84a0
Compare
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.
LGTM - few small changes
self.executor.spawn(async move { | ||
match channel.next().await { | ||
None => { | ||
println!("Something went wrong"); |
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.
None
happens when the channel closes (e.g. if the node shuts down). I wouldn't print any output in this case as it might give the user an impression of instability. The log below could be an info!
saying that the state machine state channel closed.
@@ -64,6 +64,7 @@ impl ListeningData { | |||
pub async fn next_event<B: BlockchainBackend>(&mut self, shared: &mut BaseNodeStateMachine<B>) -> StateEvent { | |||
info!(target: LOG_TARGET, "Listening for chain metadata updates"); | |||
shared.info = StatusInfo::Listening(ListeningInfo::new()); | |||
let _ = shared.status_event_publisher.send(shared.info.clone()).await; |
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.
Ideally, publishing an event would just be wrapped in a function
let _ = shared.status_event_publisher.send(shared.info.clone()).await; | |
shared.publish_status_event(shared.info.clone()).await; |
@@ -161,6 +161,7 @@ impl BlockSyncStrategy { | |||
) -> StateEvent | |||
{ | |||
shared.info = StatusInfo::BlockSync(BlockSyncInfo::new(None, None, None)); | |||
let _ = shared.status_event_publisher.send(shared.info.clone()).await; |
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.
Write and use a publish_status_event
function
a610e52
to
90c1c18
Compare
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.
LGTM - we might want to implement a set_state_machine_info
function that sets the info and publishes the event to remove the possibility of bugs from not publishing an event. But not NB for now
90c1c18
to
8b775e8
Compare
8b775e8
to
8147ea1
Compare
…edback Changed listing state display to be more clear Co-authored-by: Stan Bondi <[email protected]> Add comment to describe why the channel will never be empty
8147ea1
to
a6a9cd6
Compare
Description
Adds a channel to the base_node parser to listen for state machine publisher to publish its state and info.
Motivation and Context
This PR provides feedback for the user to see what the status and info from the state machine is, like how syncing is, is it syncing etc.
How Has This Been Tested?
Types of changes
Checklist:
development
branch.cargo-fmt --all
before pushing.