@trigger.dev/redis-worker 4.5.0-rc.4 → 4.5.0-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -2192,6 +2192,10 @@ declare function deserialiseSnapshot<T = unknown>(serialised: string): T;
2192
2192
  type MollifierBufferOptions = {
2193
2193
  redisOptions: RedisOptions;
2194
2194
  logger?: Logger;
2195
+ ackGraceTtlSeconds?: number;
2196
+ maxRetriesPerRequest?: number;
2197
+ reconnectStepMs?: number;
2198
+ reconnectMaxMs?: number;
2195
2199
  };
2196
2200
  type SnapshotPatch = {
2197
2201
  type: "append_tags";
@@ -2248,6 +2252,7 @@ declare class MollifierBuffer {
2248
2252
  #private;
2249
2253
  private readonly redis;
2250
2254
  private readonly logger;
2255
+ private readonly ackGraceTtlSeconds;
2251
2256
  constructor(options: MollifierBufferOptions);
2252
2257
  accept(input: {
2253
2258
  runId: string;
@@ -2292,6 +2297,8 @@ declare class MollifierBuffer {
2292
2297
  code: string;
2293
2298
  message: string;
2294
2299
  }): Promise<boolean>;
2300
+ getDrainingCount(): Promise<number>;
2301
+ listStaleDraining(olderThanMs: number, limit: number): Promise<string[]>;
2295
2302
  getEntryTtlSeconds(runId: string): Promise<number>;
2296
2303
  evaluateTrip(envId: string, options: {
2297
2304
  windowMs: number;
@@ -2306,16 +2313,16 @@ declare class MollifierBuffer {
2306
2313
  declare module "@internal/redis" {
2307
2314
  interface RedisCommander<Context> {
2308
2315
  acceptMollifierEntry(entryKey: string, queueKey: string, orgsKey: string, runId: string, envId: string, orgId: string, payload: string, createdAt: string, createdAtMicros: string, orgEnvsPrefix: string, idempotencyLookupKey: string, entryPrefix: string, callback?: Callback<number | string>): Result<number | string, Context>;
2309
- popAndMarkDraining(queueKey: string, orgsKey: string, entryPrefix: string, envId: string, orgEnvsPrefix: string, callback?: Callback<string | null>): Result<string | null, Context>;
2310
- requeueMollifierEntry(entryKey: string, orgsKey: string, queuePrefix: string, runId: string, orgEnvsPrefix: string, callback?: Callback<number>): Result<number, Context>;
2316
+ popAndMarkDraining(queueKey: string, orgsKey: string, drainingSetKey: string, entryPrefix: string, envId: string, orgEnvsPrefix: string, callback?: Callback<string | null>): Result<string | null, Context>;
2317
+ requeueMollifierEntry(entryKey: string, orgsKey: string, drainingSetKey: string, queuePrefix: string, runId: string, orgEnvsPrefix: string, callback?: Callback<number>): Result<number, Context>;
2311
2318
  mutateMollifierSnapshot(entryKey: string, patchJson: string, callback?: Callback<string>): Result<string, Context>;
2312
2319
  casSetMollifierMetadata(entryKey: string, expectedVersion: string, newMetadata: string, newMetadataType: string, callback?: Callback<string>): Result<string, Context>;
2313
2320
  resetMollifierIdempotency(lookupKey: string, entryPrefix: string, claimKey: string, callback?: Callback<string>): Result<string, Context>;
2314
2321
  claimMollifierIdempotency(claimKey: string, pendingMarker: string, pendingPrefix: string, ttlSeconds: string, callback?: Callback<string>): Result<string, Context>;
2315
2322
  publishMollifierClaim(claimKey: string, ownerMarker: string, runId: string, ttlSeconds: string, callback?: Callback<number>): Result<number, Context>;
2316
2323
  releaseMollifierClaim(claimKey: string, ownerMarker: string, callback?: Callback<number>): Result<number, Context>;
2317
- ackMollifierEntry(entryKey: string, graceTtlSeconds: string, callback?: Callback<number>): Result<number, Context>;
2318
- failMollifierEntry(entryKey: string, errorPayload: string, callback?: Callback<number>): Result<number, Context>;
2324
+ ackMollifierEntry(entryKey: string, drainingSetKey: string, graceTtlSeconds: string, runId: string, callback?: Callback<number>): Result<number, Context>;
2325
+ failMollifierEntry(entryKey: string, drainingSetKey: string, errorPayload: string, runId: string, callback?: Callback<number>): Result<number, Context>;
2319
2326
  delMollifierKeyIfEquals(key: string, expected: string, callback?: Callback<number>): Result<number, Context>;
2320
2327
  mollifierEvaluateTrip(rateKey: string, trippedKey: string, windowMs: string, threshold: string, holdMs: string, callback?: Callback<[number, number]>): Result<[number, number], Context>;
2321
2328
  }
@@ -2352,6 +2359,9 @@ type MollifierDrainerOptions<TPayload> = {
2352
2359
  isRetryable: (err: unknown) => boolean;
2353
2360
  pollIntervalMs?: number;
2354
2361
  maxOrgsPerTick?: number;
2362
+ drainBatchSize?: number;
2363
+ maxBackoffMs?: number;
2364
+ backoffFloorMs?: number;
2355
2365
  logger?: Logger;
2356
2366
  };
2357
2367
  type DrainResult = {
@@ -2366,8 +2376,11 @@ declare class MollifierDrainer<TPayload = unknown> {
2366
2376
  private readonly isRetryable;
2367
2377
  private readonly pollIntervalMs;
2368
2378
  private readonly maxOrgsPerTick;
2379
+ private readonly drainBatchSize;
2380
+ private readonly concurrency;
2381
+ private readonly maxBackoffMs;
2382
+ private readonly backoffFloorMs;
2369
2383
  private readonly logger;
2370
- private readonly limit;
2371
2384
  private orgCursor;
2372
2385
  private perOrgEnvCursors;
2373
2386
  private isRunning;
@@ -2384,7 +2397,6 @@ declare class MollifierDrainer<TPayload = unknown> {
2384
2397
  private delay;
2385
2398
  private takeOrgSlice;
2386
2399
  private pickEnvForOrg;
2387
- private processOneFromEnv;
2388
2400
  private processEntry;
2389
2401
  }
2390
2402
 
package/dist/index.d.ts CHANGED
@@ -2192,6 +2192,10 @@ declare function deserialiseSnapshot<T = unknown>(serialised: string): T;
2192
2192
  type MollifierBufferOptions = {
2193
2193
  redisOptions: RedisOptions;
2194
2194
  logger?: Logger;
2195
+ ackGraceTtlSeconds?: number;
2196
+ maxRetriesPerRequest?: number;
2197
+ reconnectStepMs?: number;
2198
+ reconnectMaxMs?: number;
2195
2199
  };
2196
2200
  type SnapshotPatch = {
2197
2201
  type: "append_tags";
@@ -2248,6 +2252,7 @@ declare class MollifierBuffer {
2248
2252
  #private;
2249
2253
  private readonly redis;
2250
2254
  private readonly logger;
2255
+ private readonly ackGraceTtlSeconds;
2251
2256
  constructor(options: MollifierBufferOptions);
2252
2257
  accept(input: {
2253
2258
  runId: string;
@@ -2292,6 +2297,8 @@ declare class MollifierBuffer {
2292
2297
  code: string;
2293
2298
  message: string;
2294
2299
  }): Promise<boolean>;
2300
+ getDrainingCount(): Promise<number>;
2301
+ listStaleDraining(olderThanMs: number, limit: number): Promise<string[]>;
2295
2302
  getEntryTtlSeconds(runId: string): Promise<number>;
2296
2303
  evaluateTrip(envId: string, options: {
2297
2304
  windowMs: number;
@@ -2306,16 +2313,16 @@ declare class MollifierBuffer {
2306
2313
  declare module "@internal/redis" {
2307
2314
  interface RedisCommander<Context> {
2308
2315
  acceptMollifierEntry(entryKey: string, queueKey: string, orgsKey: string, runId: string, envId: string, orgId: string, payload: string, createdAt: string, createdAtMicros: string, orgEnvsPrefix: string, idempotencyLookupKey: string, entryPrefix: string, callback?: Callback<number | string>): Result<number | string, Context>;
2309
- popAndMarkDraining(queueKey: string, orgsKey: string, entryPrefix: string, envId: string, orgEnvsPrefix: string, callback?: Callback<string | null>): Result<string | null, Context>;
2310
- requeueMollifierEntry(entryKey: string, orgsKey: string, queuePrefix: string, runId: string, orgEnvsPrefix: string, callback?: Callback<number>): Result<number, Context>;
2316
+ popAndMarkDraining(queueKey: string, orgsKey: string, drainingSetKey: string, entryPrefix: string, envId: string, orgEnvsPrefix: string, callback?: Callback<string | null>): Result<string | null, Context>;
2317
+ requeueMollifierEntry(entryKey: string, orgsKey: string, drainingSetKey: string, queuePrefix: string, runId: string, orgEnvsPrefix: string, callback?: Callback<number>): Result<number, Context>;
2311
2318
  mutateMollifierSnapshot(entryKey: string, patchJson: string, callback?: Callback<string>): Result<string, Context>;
2312
2319
  casSetMollifierMetadata(entryKey: string, expectedVersion: string, newMetadata: string, newMetadataType: string, callback?: Callback<string>): Result<string, Context>;
2313
2320
  resetMollifierIdempotency(lookupKey: string, entryPrefix: string, claimKey: string, callback?: Callback<string>): Result<string, Context>;
2314
2321
  claimMollifierIdempotency(claimKey: string, pendingMarker: string, pendingPrefix: string, ttlSeconds: string, callback?: Callback<string>): Result<string, Context>;
2315
2322
  publishMollifierClaim(claimKey: string, ownerMarker: string, runId: string, ttlSeconds: string, callback?: Callback<number>): Result<number, Context>;
2316
2323
  releaseMollifierClaim(claimKey: string, ownerMarker: string, callback?: Callback<number>): Result<number, Context>;
2317
- ackMollifierEntry(entryKey: string, graceTtlSeconds: string, callback?: Callback<number>): Result<number, Context>;
2318
- failMollifierEntry(entryKey: string, errorPayload: string, callback?: Callback<number>): Result<number, Context>;
2324
+ ackMollifierEntry(entryKey: string, drainingSetKey: string, graceTtlSeconds: string, runId: string, callback?: Callback<number>): Result<number, Context>;
2325
+ failMollifierEntry(entryKey: string, drainingSetKey: string, errorPayload: string, runId: string, callback?: Callback<number>): Result<number, Context>;
2319
2326
  delMollifierKeyIfEquals(key: string, expected: string, callback?: Callback<number>): Result<number, Context>;
2320
2327
  mollifierEvaluateTrip(rateKey: string, trippedKey: string, windowMs: string, threshold: string, holdMs: string, callback?: Callback<[number, number]>): Result<[number, number], Context>;
2321
2328
  }
@@ -2352,6 +2359,9 @@ type MollifierDrainerOptions<TPayload> = {
2352
2359
  isRetryable: (err: unknown) => boolean;
2353
2360
  pollIntervalMs?: number;
2354
2361
  maxOrgsPerTick?: number;
2362
+ drainBatchSize?: number;
2363
+ maxBackoffMs?: number;
2364
+ backoffFloorMs?: number;
2355
2365
  logger?: Logger;
2356
2366
  };
2357
2367
  type DrainResult = {
@@ -2366,8 +2376,11 @@ declare class MollifierDrainer<TPayload = unknown> {
2366
2376
  private readonly isRetryable;
2367
2377
  private readonly pollIntervalMs;
2368
2378
  private readonly maxOrgsPerTick;
2379
+ private readonly drainBatchSize;
2380
+ private readonly concurrency;
2381
+ private readonly maxBackoffMs;
2382
+ private readonly backoffFloorMs;
2369
2383
  private readonly logger;
2370
- private readonly limit;
2371
2384
  private orgCursor;
2372
2385
  private perOrgEnvCursors;
2373
2386
  private isRunning;
@@ -2384,7 +2397,6 @@ declare class MollifierDrainer<TPayload = unknown> {
2384
2397
  private delay;
2385
2398
  private takeOrgSlice;
2386
2399
  private pickEnvForOrg;
2387
- private processOneFromEnv;
2388
2400
  private processEntry;
2389
2401
  }
2390
2402