store-and-sync-state: use this.sql synchronously #25396
Open
+3
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
fixes #25018
copying summary from there:
Existing documentation URL(s)
https://developers.cloudflare.com/agents/api-reference/store-and-sync-state/#sql-api
The first example of the
this.sql
helper usesawait
which is functional but misleading that it's necessary(?) and doesn't showcase the value:I think it's also probably misleading to imply the return value from that particular sql query is
user
giventhis.sql
returns an array? Have I got this wrong?What changes are you suggesting?
An sync/singular example like
Additional information
Intro blog mentions it's synchronous! https://blog.cloudflare.com/sqlite-in-durable-objects/#reads-and-writes-are-synchronous
Screenshots (optional)
Documentation checklist
[ ] Is there a changelog entry (guidelines)? If you don't add one for something awesome and new (however small) — how will our customers find out? Changelogs are automatically posted to RSS feeds, the Discord, and X.[ ] The documentation style guide has been adhered to.[ ] If a larger change - such as adding a new page- an issue has been opened in relation to any incorrect or out of date information that this PR fixes.[ ] Files which have changed name or location have been allocated redirects.