今日已更新 233 条资讯 | 累计 20205 条内容
关于我们

Coordinating a web app with an external workflow runner: callbacks vs polling task runs?

/u/ojus_render 2026年07月11日 08:31 5 次阅读 来源:Reddit r/programming

Offloading fan-out work to Render Workflows (docs linked above). Retries and parallel tasks live there. My problem is the web layer. First version: return 202, tasks POST back to /internal/events with a bearer token, UI subscribes over SSE. Added a reconciler that polls the Render API every 2s anyway because I didn't trust callbacks alone. Second version: skip callbacks entirely. One POST stays open, poll getTaskRun every 1.5s in an async generator, stream SSE until the digest finishes. Postgres at the end. Less wiring, but the HTTP request lives for the whole run. Both work on small traffic. I'm not sure which one I'd keep if this wasn't a demo. Restarting the API wipes in-memory viewer state in the callback version. Workflow keeps going, which is fine, but the UI looks stuck unless you reconcile. Polling version doesn't have that split because the request IS the session. Has anyone shipped callbacks + poll backup long term? Or do you pick one and accept the downsides? Callback handler: github.com/ojusave/dealhealth-playground/blob/main/services/api/src/routes/events.ts Poll loop: github.com/ojusave/read-it-for-me/blob/main/server/lib/orchestrator.ts submitted by /u/ojus_render [link] [留言]

本文内容来源于互联网,版权归原作者所有
查看原文