-
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.
-
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.
-
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.
-
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?