正在加载视频...

视频加载失败

Real-time updates for Cloudflare Workflows using Durable Objects: - create Workflow with UUID - create Durable Object (same UUID) - create update method - browser opens socket connection to Durable Object Each Workflow step calls the `update` method of the DO

18,919 次观看 • 5 天前 •via X (Twitter)

18 条评论

D. Sokolov 的头像
D. Sokolov5 天前

worth flipping one assumption: don’t call update on every step. Push only human-meaningful checkpoints (started / waiting / failed / done). Otherwise the progress UI becomes a log firehose and the DO is just an expensive console.log.

Cloudflare Developers 的头像
Cloudflare Developers5 天前

Yes absolutely. You can imagine the stereotypical path is one update for step, but obviously only for the ones that make sense for th euser

D. Sokolov 的头像
D. Sokolov5 天前

euser is the end user or user from EU? different users:))

zanoum 的头像
zanoum5 天前

Cloudflare always rocking

Colbert 的头像
Colbert5 天前

This pattern is super clean. Using DOs as the glue for real-time state updates makes the whole workflow feel much more responsive for the end user.

Cloudflare Developers 的头像
Cloudflare Developers5 天前

We thought so!

DataEatsWorld 的头像
DataEatsWorld5 天前

can you stop to do cool stuff ?

Cloudflare Developers 的头像
Cloudflare Developers5 天前

What do you mean?

DataEatsWorld 的头像
DataEatsWorld5 天前

I meant the opposite: stop making cool stuff, I cannot keep up. @HoldsUpApp runs on Workers, D1, Workflows and one container, and this is the piece I was missing for live pipeline progress.

Mena Botrous 的头像
Mena Botrous5 天前

the shared uuid makes this click for me. every step can report through the same durable object, so the browser gets one live view of the run.

lin qi 的头像
lin qi4 天前

can anyone help me solve this problem, I can't visit any website with cf.

Ricci Research 的头像
Ricci Research5 天前

Sharing a UUID between the Workflow and the Durable Object is a neat trick — it turns "where do I put the progress state" into a naming convention instead of a service. The interesting question is what happens on retry: if a step re-runs, does the DO get the update twice, and is `update` idempotent by design or by discipline?

Cloudflare Developers 的头像
Cloudflare Developers5 天前

The basic implementation would see the same update twice. BUT that shouldn't matter if it's the same status right? The user wouldn't know the difference

John Rood 的头像
John Rood5 天前

the socket should be disposable. persist a monotonic event cursor in the Durable Object and replay missed workflow updates after reconnect. otherwise every laptop sleep turns a correct workflow into a lying progress UI.

Cloudflare Developers 的头像
Cloudflare Developers5 天前

I think that's one piece we didn't cover in the short tweet. The concept of saving the latest status to key/value store in DO. Then, share that status immediately on new connections. That what you mean?

ucixrn 的头像
ucixrn5 天前

Cool

Abd Mcs 的头像
Abd Mcs5 天前

I love the video format. It’s pleasant to watch it on the phone without having to rotate

Dhravya Shah 的头像
Dhravya Shah5 天前

oh what

相关视频