Sweaty Imposter

Process Synchronously in the Request Handler Versus Enqueue and Process Asynchronously

TradeoffMidSeniorUpdated

A user uploads a video that must be transcoded into 5 resolutions before being playable.

Short answer: Enqueue and process asynchronously. Transcoding takes minutes, far exceeding any reasonable HTTP timeout.

The Two Options

A

Process synchronously in the request handler

B

Enqueue and process asynchronously

Drill This: Your Pick First

The Better Pick

Option B

Enqueue and process asynchronously

Transcoding takes minutes, far exceeding any reasonable HTTP timeout. Queue + worker pool decouples upload from processing and allows retries.

When the Other One Wins

Process synchronously in the request handler

For sub-second operations where the caller needs the result immediately, async adds complexity (polling, callbacks) without benefit.