Add non-waking container fetch method#212
Open
ghostwriternr wants to merge 1 commit into
Open
Conversation
Expose fetchIfRunning so callers can proxy to an already healthy container without using wake-capable fetch paths. This lets consumers serve passive traffic without accidentally starting stopped containers.
commit: |
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.
Some request paths need to proxy traffic only when a container is already available. The Sandbox SDK preview URL path is one example: stale preview URL requests should be rejected without waking or starting a stopped container. Other passive traffic, health-adjacent routing, or authorization-gated proxy paths have the same requirement.
Today the
Containerclass exposesfetch()andcontainerFetch()for forwarding, but both start the container and wait for ports before proxying the request. That makes callers choose between accidentally waking containers or duplicating the base class's forwarding logic.This adds
fetchIfRunning()as a non-waking forwarding primitive. It forwards only when the container is already running and marked healthy, and otherwise returns without starting, probing, or waiting for ports.containerFetch()now shares the same internal forwarding helper after its existing start/wait behavior succeeds, so HTTP, WebSocket, activity timeout, and inflight request accounting stay consistent across both paths.