Skip to content

Commit

Permalink
feat(update): minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcrea committed Jul 5, 2024
1 parent 02b8464 commit f9629f1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/PrismaQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
export type PrismaQueueOptions = {
prisma?: PrismaClient;
name?: string;
maxAttempts?: number | null;
maxConcurrency?: number;
pollInterval?: number;
jobInterval?: number;
Expand Down Expand Up @@ -89,6 +90,7 @@ export class PrismaQueue<
name = "default",
modelName = "QueueJob",
tableName = getTableName(modelName),
maxAttempts = null,
maxConcurrency = DEFAULT_MAX_CONCURRENCY,
pollInterval = DEFAULT_POLL_INTERVAL,
jobInterval = DEFAULT_JOB_INTERVAL,
Expand All @@ -105,6 +107,7 @@ export class PrismaQueue<
this.config = {
modelName,
tableName,
maxAttempts,
maxConcurrency,
pollInterval,
jobInterval,
Expand Down Expand Up @@ -172,8 +175,8 @@ export class PrismaQueue<
options: EnqueueOptions = {},
): Promise<PrismaJob<T, U>> {
debug(`enqueue`, this.name, payloadOrFunction, options);
const { name: queueName } = this;
const { key, cron = null, maxAttempts = null, priority = 0, runAt } = options;
const { name: queueName, config } = this;
const { key, cron = null, maxAttempts = config.maxAttempts, priority = 0, runAt } = options;
const record = await this.#prisma.$transaction(async (client) => {
const payload =
payloadOrFunction instanceof Function ? await payloadOrFunction(client) : payloadOrFunction;
Expand Down

0 comments on commit f9629f1

Please sign in to comment.