You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve session initialization to check storage first (#281)
* Improve session initialization to check storage first
Reduces unnecessary "session already exists" errors by checking
DO storage before attempting to create a new session.
* Add changeset for session initialization fix
* Remove redundant storage check from session initialization
The storage check was defensive code that added latency but rarely
helped since the constructor already loads defaultSession from storage
via blockConcurrencyWhile.
* Use RESOURCE_BUSY error code for session conflicts
Changes INTERNAL_ERROR (500) to RESOURCE_BUSY (409) for "session
already exists" errors. This prevents noisy ERROR-level logs during
wrangler dev hot reloads since the SDK only logs 5xx errors.
Also improves the debug message to clarify state divergence.
* Use error code instead of string matching for session conflicts
String matching on error.message is fragile - if the message wording
changes, the code silently breaks. Using error.code is type-safe and
reliable.
* Add SESSION_ALREADY_EXISTS error code for session conflicts
Replaces RESOURCE_BUSY with a semantically correct error code that
properly indicates a uniqueness constraint violation rather than a
temporary lock.
**Subject line should stand alone** - don't require reading the body to understand the change. Body is optional and only needed for non-obvious context.
293
293
294
+
**Focus on the change, not how it was discovered** - never reference "review feedback", "PR comments", or "code review" in commit messages. Describe what the change does and why, not that someone asked for it.
295
+
296
+
**Avoid bullet points** - write prose, not lists. If you need bullets to explain a change, you're either committing too much at once or over-explaining implementation details. The body should be a brief paragraph, not a changelog.
0 commit comments