File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed
internal-packages/run-engine/src/batch-queue
packages/redis-worker/src Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
1313 CallbackFairQueueKeyProducer ,
1414 WorkerQueueManager ,
1515 BatchedSpanManager ,
16+ isAbortError ,
1617 type FairQueueOptions ,
1718 type StoredMessage ,
1819} from "@trigger.dev/redis-worker" ;
@@ -663,7 +664,7 @@ export class BatchQueue {
663664 }
664665 }
665666 } catch ( error ) {
666- if ( error instanceof Error && error . name === "AbortError" ) {
667+ if ( isAbortError ( error ) ) {
667668 this . logger . debug ( "Worker queue consumer aborted" , { loopId } ) ;
668669 this . batchedSpanManager . cleanup ( loopId ) ;
669670 return ;
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { type z } from "zod";
77import { ConcurrencyManager } from "./concurrency.js" ;
88import { MasterQueue } from "./masterQueue.js" ;
99import { type RetryStrategy , ExponentialBackoffRetry } from "./retry.js" ;
10+ import { isAbortError } from "../utils.js" ;
1011import {
1112 FairQueueTelemetry ,
1213 FairQueueAttributes ,
@@ -769,7 +770,7 @@ export class FairQueue<TPayloadSchema extends z.ZodTypeAny = z.ZodUnknown> {
769770 } ) ;
770771 }
771772 } catch ( error ) {
772- if ( error instanceof Error && error . message === "AbortError" ) {
773+ if ( isAbortError ( error ) ) {
773774 this . logger . debug ( "Master queue consumer aborted" , { loopId } ) ;
774775 this . batchedSpanManager . cleanup ( loopId ) ;
775776 return ;
@@ -1330,7 +1331,7 @@ export class FairQueue<TPayloadSchema extends z.ZodTypeAny = z.ZodUnknown> {
13301331 }
13311332 }
13321333 } catch ( error ) {
1333- if ( error instanceof Error && error . name === "AbortError" ) {
1334+ if ( isAbortError ( error ) ) {
13341335 this . logger . debug ( "Reclaim loop aborted" ) ;
13351336 return ;
13361337 }
Original file line number Diff line number Diff line change 11export * from "./queue.js" ;
22export * from "./worker.js" ;
3+ export * from "./utils.js" ;
34
45// Fair Queue System
56export * from "./fair-queue/index.js" ;
Original file line number Diff line number Diff line change 1+ /**
2+ * Check if an error is an AbortError.
3+ *
4+ * This handles both:
5+ * - Custom abort errors created with `new Error("AbortError")` (sets .message)
6+ * - Native Node.js AbortError from timers/promises (sets .name)
7+ */
8+ export function isAbortError ( error : unknown ) : boolean {
9+ return (
10+ error instanceof Error && ( error . name === "AbortError" || error . message === "AbortError" )
11+ ) ;
12+ }
You can’t perform that action at this time.
0 commit comments