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 async_cleanup() method to ServerApp trait #193

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions pingora-core/src/apps/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ pub trait ServerApp {

/// This callback will be called once after the service stops listening to its endpoints.
fn cleanup(&self) {}

/// This callback will be called once after the service stops listening to its endpoints.
///
/// Used for async cleanup tasks.
async fn async_cleanup(&self) {}
YHM404 marked this conversation as resolved.
Show resolved Hide resolved
}

/// This trait defines the interface of an HTTP application.
Expand Down
1 change: 1 addition & 0 deletions pingora-core/src/services/listening.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ impl<A: ServerApp + Send + Sync + 'static> ServiceTrait for Service<A> {
futures::future::join_all(handlers).await;
self.listeners.cleanup();
self.app_logic.cleanup();
self.app_logic.async_cleanup().await;
}

fn name(&self) -> &str {
Expand Down