Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

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 Aufrufe • vor 5 Tagen •via X (Twitter)

18 Kommentare

Profilbild von D. Sokolov
D. Sokolovvor 5 Tagen

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.

Profilbild von Cloudflare Developers
Cloudflare Developersvor 5 Tagen

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

Profilbild von D. Sokolov
D. Sokolovvor 5 Tagen

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

Profilbild von zanoum
zanoumvor 5 Tagen

Cloudflare always rocking

Profilbild von Colbert
Colbertvor 5 Tagen

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.

Profilbild von Cloudflare Developers
Cloudflare Developersvor 5 Tagen

We thought so!

Profilbild von DataEatsWorld
DataEatsWorldvor 5 Tagen

can you stop to do cool stuff ?

Profilbild von Cloudflare Developers
Cloudflare Developersvor 5 Tagen

What do you mean?

Profilbild von DataEatsWorld
DataEatsWorldvor 5 Tagen

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.

Profilbild von Mena Botrous
Mena Botrousvor 5 Tagen

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.

Profilbild von lin qi
lin qivor 4 Tagen

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

Profilbild von Ricci Research
Ricci Researchvor 5 Tagen

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?

Profilbild von Cloudflare Developers
Cloudflare Developersvor 5 Tagen

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

Profilbild von John Rood
John Roodvor 5 Tagen

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.

Profilbild von Cloudflare Developers
Cloudflare Developersvor 5 Tagen

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?

Profilbild von ucixrn
ucixrnvor 5 Tagen

Cool

Profilbild von Abd Mcs
Abd Mcsvor 5 Tagen

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

Profilbild von Dhravya Shah
Dhravya Shahvor 5 Tagen

oh what

Ähnliche Videos