Go: a fast integration must also know when to stop

Parallel requests help only when they have boundaries. Use deadlines and cancellation to contain a slow external dependency.

One slow partner holds up the whole screen

Imagine a delivery comparison service asking several carriers for a price. Most reply quickly, but one stops responding. Without boundaries, that delay can occupy resources long after the customer leaves the page.

Go's context package carries deadlines and cancellation signals between functions. The code doing the work must cooperate with that signal. The Go Context guide explains this model.

Give the whole operation a time budget

Setting a generous timeout on every individual call is not enough. Define how long the complete screen may take and how much of that budget belongs to external responses. Decide whether partial results are useful: one missing delivery quote does not always invalidate the others.

Bound concurrency too. Starting a goroutine is convenient, but the partner service and connection pool have finite capacity. When work accumulates, the application needs a defined way to defer or reject it.

Cancellation does not undo side effects

Stopping the wait does not prove that a partner skipped the operation. When booking a shipment, distinguish a missing response from a confirmed rejection. Retrying should use an operation identifier and the capabilities of that particular API.

Test a slow partner, a disconnected customer and a burst of simultaneous requests. Observe active work and connection usage after the test finishes. A robust integration stops unnecessary work and gives users an understandable outcome instead of simply launching more tasks at once.