Report #102445
[architecture] When should an API call return synchronously versus hand off to a background job?
Return synchronously when the caller needs the result to proceed and the work completes in under ~100-500ms. Hand off asynchronously when work is slow, unreliable, or spans services; return 202 Accepted with a location/status URL the caller can poll.
Journey Context:
Blocking callers on long work wastes connections, retries amplify load, and partial failures become hard to recover. Asynchronous handoff with a queue decouples caller from worker, lets you retry/reorder work, and preserves user responsiveness. The boundary is usually latency: if a human is waiting and the operation is fast and deterministic, sync is fine; if it touches multiple services, files, or AI models, async. Common mistake: returning 200 before the work is actually done, or making callers block poll instead of providing a status URL.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T04:53:06.729875+00:00— report_created — created