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 async_cleanup()
method to ServerApp
trait
#193
Conversation
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.
Discussing internally: though it would be a breaking change, we thought it would be preferable to make the existing cleanup()
an async function for simplicity, especially while we are still in v0. Does that resolve your issue, and would you be able to make that change?
I have made the corresponding modifications to the PR. This should resolve my issue. Thank you for your reply. |
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, thank you! I will sync this up internally.
This change is now available via 42b0224. Thanks for the contribution. |
Motivation:
In the current implementation of
ServerApp
trait (name the trait if possible), we have a synchronous methodcleanup
designed to clean up resources when a service is stopped. However, as our application evolves and embraces more asynchronous operations, the need for an asynchronous cleanup method has become apparent. This addition will allow for non-blocking resource cleanup, aligning with the asynchronous nature of our other operations.Changes:
Added
async fn async_cleanup()
: Introduced a new asynchronous function, async_cleanup, to theServerApp
trait. This method is intended to asynchronously clean up resources, complementing the existingcleanup
method.Compatibility Considerations: To ensure backward compatibility and minimize disruption, the existing
cleanup
method remains unchanged. Users can choose between cleanup for synchronous operations andasync_cleanup
for asynchronous operations, depending on their use case.