UNPKG

@backgroundjs/core

Version:

An extendible background job queue for js/ts applications

36 lines (35 loc) 1.09 kB
import { JobStorage } from "../storage/base-storage"; import { JobQueue } from "./job-queue"; import { Job } from "../types"; export declare class PostgreSQLJobQueue extends JobQueue { private readonly postgresStorage; /** * Create a PostgreSQL job queue * * @param storage - PostgreSQL storage implementation * @param options - Configuration options */ constructor(storage: JobStorage, options?: { concurrency?: number; maxRetries?: number; name?: string; processingInterval?: number; logging?: boolean; intelligentPolling?: boolean; minInterval?: number; maxInterval?: number; maxEmptyPolls?: number; loadFactor?: number; standAlone?: boolean; }); /** * Process jobs with distributed locking * Override the parent's protected method */ protected processNextBatch(): Promise<void>; /** * Process a single job with locking * This is called by the parent class */ protected processJob(job: Job): Promise<void>; }