Repository navigation
feat(sdk): hand health reporter to the caller - #2
Closed
jonasz-lasut wants to merge 1 commit into
Closed
jonasz-lasut wants to merge 1 commit into
jonasz-lasut wants to merge 1 commit into
Conversation
serve_service_with_health returns the gRPC health reporter next to the server future, with the service starting as NOT SERVING; the caller flips it when ready. A function warming caches at start-up can serve requests immediately (health is what probes read, not a gate) while probes correctly see it as not ready - a closed port would read as a crashed process instead. serve_service delegates, reporting serving up front as before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
Superseded by the ServerBuilder rework in #3: a builder composes custom codec, caller-owned health and extra services in one chain instead of accumulating free functions. The health-reporter semantics (NOT_SERVING start, requests served regardless, caller flips) carry over as ServerBuilder::health_reporter. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
serve_service_with_health, which returns the gRPCHealthReporteralongside the server future instead of reporting the service as serving up front. The service starts as NOT_SERVING; the caller flips it withset_servingwhen ready.serve_service(#1) becomes a delegate that flips to serving immediately, so existing behavior is unchanged.HealthReporteris re-exported so callers do not need a direct tonic-health dependency.Why
A function that does start-up work - warming module caches, compiling wasm - should listen immediately and let probes read NOT_SERVING while it warms: a closed port reads as a crashed process (connection refused) and can restart-loop the pod, while NOT_SERVING on an open port is exactly the state gRPC health exists to express. Requests arriving mid-warm-up are served (cold) regardless of health status - health is what probes read, not a gate. This is the readiness shape function-wasm's Go runtime has; the handle lets the Rust runtime match it.
Notes
+ use<S>precise capturing keeps the future'static(it borrows nothing fromArgs), so it can betokio::spawned.Slated for 0.3.0 together with #1.