When is an uploaded video actually ready to publish?

  1. Create the short-video upload and save the returned upload ID. An accepted upload request means the file was received, not necessarily that the video is ready for a publish request. Keep the upload ID with the intended post so the next step checks the same media item rather than starting another upload. If the create request fails, log that failure separately from processing failures.

  2. Poll the upload’s processing endpoint before publishing. Use the states and fields that endpoint actually returns; don’t assume every provider uses the same names. A minimal loop can check after 2 seconds, then 4, 8, and so on, capped at 20 seconds between checks and a 5-minute overall deadline. Stop immediately on a terminal processing failure. If a response gives a retry delay, respect it, but never extend the deadline indefinitely.

  3. Treat the deadline as a real outcome. If the video is still processing after five minutes, mark the job as stalled, retain the upload ID, and surface its last observed state and last successful poll time. That gives someone enough information to distinguish slow processing from a poller that stopped making requests. Re-uploading at this point may create another media item without fixing the original problem.

  4. Publish only after the upload reports ready. Send the publish request using the completed media ID, then store its response and resulting post ID or error. This keeps “upload accepted,” “video ready,” and “post published” as three separate facts in the log.

How do you choose a polling deadline for short videos, and where do stalled jobs become visible to the person expecting the post?

  1. Measure processing time from upload acceptance to ready for each provider and short-video type. Set the deadline near a high observed percentile, add a bounded margin, and cap it explicitly; review it as latency changes.

  2. Route expired jobs to the responsible person’s operational queue. Show the upload ID, intended publish time, last processing state, last successful poll time, and latest poll error so slow processing is distinguishable from a stopped poller.

A publish timeout is different from an explicit publish failure: the request may have succeeded even though its response never arrived. Keep the same stable job ID and, if the provider supports idempotency keys, reuse the original key when retrying. Otherwise, check for a resulting post tied to that media item and intended account before sending another publish request. If you find it, record its post ID and close the job. If you cannot establish whether it exists, leave the outcome unknown rather than risk publishing the same video twice.

For stable job ID J42, mark publish attempt A1 outcome_unknown after the timeout and run a bounded reconciliation pass, such as three checks over 60 seconds. If a resulting post is confirmed, attach it to J42; otherwise, keep the attempt unresolved rather than marking it failed. A lost response is not evidence that publishing failed.

A webhook or completion callback is preferable if the provider supports one; keep polling as a fallback, with jitter so many uploads don’t all hit the status endpoint at once. Track processing latency by provider and file size, then tune the deadline from actual data. Surface the job in the scheduler’s exception queue, not just application logs.