-
Notifications
You must be signed in to change notification settings - Fork 3.3k
improvement(rooms): redis client closed should fail with indicator #3115
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
base: staging
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR improves error handling when Redis is unavailable by implementing a fail-fast strategy. The changes introduce an Key improvements:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Frontend Client
participant Socket as Socket Handler
participant RoomMgr as Room Manager
participant Redis as Redis
Note over Redis: Redis becomes unavailable
Redis-->>RoomMgr: Connection closed
RoomMgr->>RoomMgr: isConnected = false
Client->>Socket: join-workflow-request
Socket->>RoomMgr: isReady()
RoomMgr-->>Socket: false
Socket->>Client: join-workflow-error<br/>{code: ROOM_MANAGER_UNAVAILABLE}
Client->>Client: triggerOfflineMode()
Client->>Socket: workflow-operation
Socket->>RoomMgr: isReady()
RoomMgr-->>Socket: false
Socket->>Client: operation-forbidden<br/>{type: ROOM_MANAGER_UNAVAILABLE}
Socket->>Client: operation-failed<br/>{retryable: true}
Note over Redis: Redis reconnects
Redis-->>RoomMgr: Connection ready
RoomMgr->>RoomMgr: isConnected = true
Client->>Socket: join-workflow-request
Socket->>RoomMgr: isReady()
RoomMgr-->>Socket: true
Socket->>RoomMgr: addUserToRoom()
RoomMgr->>Redis: Store session data
Redis-->>RoomMgr: Success
Socket->>Client: workflow-state
|
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.
4 files reviewed, no comments
|
@cursor review |
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.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| }) | ||
| } | ||
| return | ||
| } |
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.
Unprotected Redis call can cause unhandled promise rejection
Low Severity
The hasWorkflowRoom call at line 70 is outside any try-catch block, unlike the getWorkflowIdForSocket and getUserSession calls which were wrapped in error handling by this PR. If Redis becomes unavailable after the isReady() check passes but before hasWorkflowRoom executes, the Redis call will throw an unhandled error. This inconsistently breaks the error handling pattern established elsewhere in this handler, potentially causing ungraceful socket disconnection without the ROOM_MANAGER_UNAVAILABLE error being sent to the client.


Summary
Type of Change
Testing
Tested manually
Checklist