Skip to content

Using blockConcurrencyWhile for Durable Objects initialisation contradictions #27441

@jonasb

Description

@jonasb

Existing documentation URL(s)

The documentation for blockConcurrencyWhile claims:

Note

You should only need blockConcurrencyWhile if you are making additional, asynchronous calls (such as to another API or service), and cannot tolerate other requests processed by the Durable Object changing its internal while the event loop is yielded from the original request.
In practice, this is quite rare, and most use cases do not need blockConcurrencyWhile.

While in the Rules of Duable Objects it reads:

This is useful for operations that must be atomic, such as state initialization from storage in the constructor:

and

For schema changes, run migrations in the constructor using blockConcurrencyWhile().

What changes are you suggesting?

Since the SQL storage operations in DO are synchronous, the two documents contradict each other. The way I understand it shouldn't be necessary to use blockConcurrencyWhile for storage operations. But since the rules explicitly says it's needed, I'm a bit confused.

Additional information

No response

Metadata

Metadata

Labels

content:editRequest for content editsdocumentationDocumentation editsproduct:durable-objectsDurable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions