-
-
Notifications
You must be signed in to change notification settings - Fork 26
Release Candidate: Upgrade to AsyncLocalStorage #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR upgrades the codebase from using cls-hooked to AsyncLocalStorage, updating corresponding tests and documentation.
- Refactor of the context implementation in index.js to use AsyncLocalStorage
- Updated test suites to validate the new return values from httpContext.set and ensure correct middleware behavior
- Revised README to reflect the new dependency and usage instructions
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/express-test-harness.js | Updated tests to capture return values from httpContext.set and add new middleware usage scenarios |
tests/browser.js | Removed deprecated test expectations for the legacy ns property |
index.js | Migrated the context implementation from cls-hooked to AsyncLocalStorage |
browser.js | Removed the ns property to align with the new context strategy |
README.md | Revised documentation to reflect the upgrade to AsyncLocalStorage |
Files not reviewed (1)
- package.json: Language not supported
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR upgrades the project from using cls-hooked to using AsyncLocalStorage and updates tests and documentation accordingly. Key changes include:
- Replacing cls-hooked with AsyncLocalStorage in index.js.
- Updating tests to capture and assert the return value from httpContext.set.
- Revising documentation to reflect the new implementation and usage instructions.
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tests/express-test-harness.js | Updates to test assertions and added return value handling from set() |
tests/browser.js | Removal of a test case checking for a null namespace property |
index.js | Replacement of cls-hooked with AsyncLocalStorage and updated set() behavior |
browser.js | Removal of the ns property; now a no-op implementation |
README.md | Documentation updates explaining the AsyncLocalStorage implementation |
Files not reviewed (1)
- package.json: Language not supported
app.use(httpContext.middleware); | ||
|
||
app.get('/test', (req, res) => { | ||
const delay = new Number(req.query.delay); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'new Number()' creates a Number object instead of a primitive, which may lead to unexpected behavior in numeric operations. Consider using Number(req.query.delay) or parseInt(req.query.delay, 10) for reliable numeric conversion.
const delay = new Number(req.query.delay); | |
const delay = Number(req.query.delay); |
Copilot uses AI. Check for mistakes.
Resolves #57
Resolves #52
Resolves #51
Resolves #47
Resolves #32
Resolves #26
Resolves #18
Resolves #15
Resolves #13