Skip to content
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

feat: add the WatchState API #582

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Rustin170506
Copy link
Collaborator

close #551
close #567

This pull request introduces a new stream API named "WatchState." Currently, it only provides the current temporality, which will enable clients to check if the server has been paused.

See more: #567 (comment)

@Rustin170506
Copy link
Collaborator Author

@hds Do you have time to take a quick look at this pull request before I continue? I want to ensure I'm on the right track and understand your feedback correctly.

Do you have any thoughts on how to use it with tokio-console? Currently, we use next_update to connect to the server and handle all the backoff stuff. I'm not sure how to use this new API in tokio-console. I'm unsure which step we should take first when we're trying to start the client. Perhaps we should watch the stats first? Or should we only watch the stats after we receive the first update?

@hds
Copy link
Collaborator

hds commented Sep 10, 2024

@Rustin170506 I think this is the right approach.

To integrate this with Tokio-Console, I would get the State stream from WatchState and include it in the tokio::select! statement in main():

tokio::select! { biased;

To make the UI "reactive" even in the event of network slow down, we may want to have some additional states in Tokio Console for "pausing" and "unpausing" which would be set in between the user pressing the space bar and the new state being received from the State stream.

Does that make sense?

@Rustin170506
Copy link
Collaborator Author

To integrate this with Tokio-Console, I would get the State stream from WatchState and include it in the tokio::select! statement in main():

The issue at hand is that when we call next_event, it attempts to connect to the server within the function. However, since we've introduced a new API, we're unsure about when we should monitor this new API. Should we have next_event establish the connection first, or should we update the logic to monitor the state API and establish the connection simultaneously?

@hds
Copy link
Collaborator

hds commented Sep 12, 2024

My thought was to do it all simultaneously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tokio-console cannot show the pause status correctly
2 participants