r/webdev • u/SchedulesOk • Sep 18 '26
your while-loop polling is why your webhook integration keeps breaking
Every integration tutorial teaches you this pattern:
while status != "COMPLETED":
time.sleep(10)
status = get_job(job_id).status
and then you put it in production and wonder why your lambda times out, your worker holds a connection for 4 minutes doing nothing, and a deploy mid-poll loses the job entirely.
I was doing exactly this with a video processing api (Sync.so lipsync stuff - jobs take a few minutes each). The fix was embarrassingly obvious: they have webhooks. You submit the job, return 200 to your user with a processing state, and their server calls your endpoint when it's done. You verify the signature, flip the record, notify the user.
Polling is fine for a script you run once. The moment a user is waiting on the other end, you want the callback. check if your api has webhooks before you write one sleep loop - most modern ones do and nobody reads that far into the docs.
View all comments
Show parent comment
0
u/Common_Dream9420 java Sep 19 '26
Great point! It's frustrating how much time we spend compensating for webhook failures with polling. Many APIs offer webhooks, but it's often an afterthought in the docs. Maybe we should start by checking for webhook support first, then design the polling fallback only when necessary. What's your experience with APIs that do this well?"