TECHNOLOGY

Google WaitOperation can return an unfinished operation

In this article
THE QUICK TAKE

A successful WaitOperation response can still contain done=false; the operation state determines completion rather than the speed or success of the wait RPC.

Wait for an existing operation rather than resubmit work

The Google long-running RPC reference defines WaitOperation using the name of an existing operation. It observes that operation until completion or at most the requested timeout. A proposed client should preserve the full operation name and originating service, because the name is only unique within that service. Losing a wait response is not a reason to invoke the original creation method again; first restore observation of the known operation identity.

Inspect done even after an immediate successful response

The reference explicitly makes waiting best effort: a server may return the latest state early, including immediately. An immediate response therefore does not establish completed work. If done is false, retain the in-progress state. If done is true, inspect the operation’s response or error according to that service’s result contract. Treating every successfully decoded wait response as the business result would convert a valid intermediate observation into a false completion signal.

Keep wait duration separate from transport deadline

WaitOperation’s timeout does not override a shorter underlying HTTP or RPC timeout. The gRPC deadline guide separately explains when the client stops waiting and receives DEADLINE_EXCEEDED. An editorial client design records both budgets and distinguishes a returned unfinished Operation from a failed wait RPC. Cancelling or timing out this observation should not be represented as an explicit service-level cancellation request for the background operation.

Fall back only to a documented observation method

The long-running-operation design guidance describes operation resources as handles for checking progress and retrieving eventual results. The RPC reference allows WaitOperation to return UNIMPLEMENTED when unsupported, while GetOperation returns the latest state for interval polling. A proposed fallback preserves the same operation identity and uses the API’s polling guidance. It should not invent a busy loop or reinterpret lack of waiting support as lack of support for the original asynchronous operation.

Test the observation states independently

A useful editorial fixture returns unfinished state immediately, unfinished state after bounded waiting, a terminal error and a terminal response. Another fixture interrupts only the wait RPC while leaving the operation record available for subsequent observation. Golden contract fixtures help keep those outcomes distinct, while request tracing separates the operation identity from each polling attempt. These checks describe a client protocol; they do not claim any background work was created or cancelled by this guide.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles