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

Add mechanism to synchronize and update services status #30

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

danielSanchezQ
Copy link
Collaborator

This is a better and simpler approach than #29 . Responsibility is of the services implementations (With great power comes great responsibility) to understand the complexities of their services relationships.

How this works?

There is tokio::sync::watch channel handled by the service. Other services can subscribe and get updated requesting a watcher (watch::Receiver) from the calls in the overwatch_handle within services themselves.
Service status do not update automatically, I think is more flexible as service may chose to mark when they are ready to work. Also when they have finished its exection.

StatusHandle holds both parts of the sender/receiver parts of the watch channel and its clonable. That way the service can spawn tasks freely and send the handle to handle internal status as well.

@danielSanchezQ
Copy link
Collaborator Author

Still missing documentation. Will be adding that next.

Copy link

@youngjoon-lee youngjoon-lee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks good! I just left a question below.

overwatch-rs/src/services/status.rs Show resolved Hide resolved
@al8n
Copy link
Contributor

al8n commented Oct 19, 2023

🚀

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

Successfully merging this pull request may close these issues.

None yet

3 participants