aboutsummaryrefslogtreecommitdiffstats
path: root/packages/shared
diff options
context:
space:
mode:
Diffstat (limited to 'packages/shared')
-rw-r--r--packages/shared/queueing.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/shared/queueing.ts b/packages/shared/queueing.ts
index 0dd6ed6b..bc2c9cfa 100644
--- a/packages/shared/queueing.ts
+++ b/packages/shared/queueing.ts
@@ -2,6 +2,21 @@ import { ZodType } from "zod";
import { PluginManager, PluginType } from "./plugins";
+/**
+ * Special error that indicates a job should be retried after a delay
+ * without counting against the retry attempts limit.
+ * Useful for handling rate limiting scenarios.
+ */
+export class QueueRetryAfterError extends Error {
+ constructor(
+ message: string,
+ public readonly delayMs: number,
+ ) {
+ super(message);
+ this.name = "QueueRetryAfterError";
+ }
+}
+
export interface EnqueueOptions {
idempotencyKey?: string;
priority?: number;