-
-
Notifications
You must be signed in to change notification settings - Fork 729
V4 dequeue performance (return faster) #1989
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,45 +14,19 @@ export const deadlockReleasingQueue = queue({ | |
export const deadlockTester = task({ | ||
id: "deadlock-tester", | ||
run: async (payload: any, { ctx }) => { | ||
// await deadlockNestedTask.triggerAndWait({ | ||
// message: "Hello, world!", | ||
// }); | ||
|
||
await deadlockNestedTask.batchTriggerAndWait([ | ||
{ | ||
payload: { | ||
message: "Hello, world!", | ||
}, | ||
}, | ||
{ | ||
payload: { | ||
message: "Hello, world!", | ||
}, | ||
}, | ||
]); | ||
await deadlockNestedTask.triggerAndWait({ | ||
message: "Hello, world!", | ||
}); | ||
Comment on lines
+17
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Infinite mutual triggering – system can still dead-lock
Tester → Nested → Tester → Nested … Add a counter or a unique correlation id to detect and stop after n hops, or use |
||
}, | ||
}); | ||
|
||
export const deadlockNestedTask = task({ | ||
id: "deadlock-nested-task", | ||
queue: deadlockQueue, | ||
run: async (payload: any, { ctx }) => { | ||
// await deadlockTester.triggerAndWait({ | ||
// message: "Hello, world!", | ||
// }); | ||
|
||
await deadlockTester.batchTriggerAndWait([ | ||
{ | ||
payload: { | ||
message: "Hello, world!", | ||
}, | ||
}, | ||
{ | ||
payload: { | ||
message: "Hello, world!", | ||
}, | ||
}, | ||
]); | ||
await deadlockTester.triggerAndWait({ | ||
message: "Hello, world!", | ||
}); | ||
|
||
return { | ||
message: "Hello, world!", | ||
|
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.
🛠️ Refactor suggestion
Errors are swallowed – consider surfacing them to callers
tryCatch
logs the error but then execution continues as if nothing happened.In production this can create “black-hole” failures where a queue is permanently unhealthy yet no call-site notices. At minimum:
Better: propagate a metric / circuit-breaker so repeated failures trigger recovery logic.