-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Description
Existing documentation URL(s)
- https://developers.cloudflare.com/durable-objects/best-practices/rules-of-durable-objects/
- https://developers.cloudflare.com/durable-objects/api/state/#blockconcurrencywhile
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