Skip to content

Commit c292f4d

Browse files
committed
Fix dropped task promise never settling in PromiseQueue
When maxQueueLength is exceeded, dropped tasks now properly reject their promises instead of leaving them hanging indefinitely.
1 parent 19eee51 commit c292f4d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

registry/src/lib/promise-queue.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ export class PromiseQueue {
4040

4141
if (this.maxQueueLength && this.queue.length >= this.maxQueueLength) {
4242
// Drop oldest task to prevent memory buildup
43-
this.queue.shift()
43+
const droppedTask = this.queue.shift()
44+
if (droppedTask) {
45+
droppedTask.reject(new Error('Task dropped: queue length exceeded'))
46+
}
4447
}
4548

4649
this.queue.push(task as QueuedTask<unknown>)

0 commit comments

Comments
 (0)