-
Notifications
You must be signed in to change notification settings - Fork 22
Feature / Async Local Storage Alternative #1054
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
Warning Rate limit exceeded@thekevinbrown has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 37 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe recent updates enhance the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant RequestContext
participant AsyncLocalStorage
participant WorkaroundStorage
Client->>RequestContext: Create context
alt AsyncLocalStorage enabled
RequestContext->>AsyncLocalStorage: Store context
else AsyncLocalStorage disabled
RequestContext->>WorkaroundStorage: Store context using mutex
end
RequestContext-->>Client: Context created
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
src/pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
Files selected for processing (2)
- src/packages/core/package.json (1 hunks)
- src/packages/core/src/request-context.ts (3 hunks)
Additional context used
Biome
src/packages/core/src/request-context.ts
[error] 48-48: Using this in a static context can be confusing.
this refers to the class.
Unsafe fix: Use the class name instead.(lint/complexity/noThisInStatic)
[error] 49-49: Using this in a static context can be confusing.
this refers to the class.
Unsafe fix: Use the class name instead.(lint/complexity/noThisInStatic)
[error] 58-58: Using this in a static context can be confusing.
this refers to the class.
Unsafe fix: Use the class name instead.(lint/complexity/noThisInStatic)
Additional comments not posted (3)
src/packages/core/package.json (1)
34-34
: Dependency addition approved.The addition of the
async-mutex
library is appropriate for managing concurrency in environments withoutAsyncLocalStorage
.src/packages/core/src/request-context.ts (2)
46-53
: Logic approved, correctthis
usage.The logic for switching between
AsyncLocalStorage
and the workaround is sound. However, correct the use ofthis
in static contexts as previously suggested.Tools
Biome
[error] 48-48: Using this in a static context can be confusing.
this refers to the class.
Unsafe fix: Use the class name instead.(lint/complexity/noThisInStatic)
[error] 49-49: Using this in a static context can be confusing.
this refers to the class.
Unsafe fix: Use the class name instead.(lint/complexity/noThisInStatic)
Line range hint
63-69
: Context creation logic approved.The
createContext
method is well-implemented and aligns with the class's purpose.Tools
Biome
[error] 48-48: Using this in a static context can be confusing.
this refers to the class.
Unsafe fix: Use the class name instead.(lint/complexity/noThisInStatic)
[error] 49-49: Using this in a static context can be confusing.
this refers to the class.
Unsafe fix: Use the class name instead.(lint/complexity/noThisInStatic)
[error] 58-58: Using this in a static context can be confusing.
this refers to the class.
Unsafe fix: Use the class name instead.(lint/complexity/noThisInStatic)
…hub.com/exogee-technology/graphweaver into feature/async-local-storage-alternative
Creates an alternative approach to context isolation for runtime environments where AsyncLocalStorage isn't supported, e.g. stackblitz/webcontainer-core#1169
We use webcontainers to run https://demo.graphweaver.com, so this is primarily to support that environment, but can be used at will from any environment this way.
Summary by CodeRabbit
New Features
AsyncLocalStorage
using a new workaround mechanism.Chores
async-mutex
, enhancing concurrency management capabilities.