/** * Periodic job scheduler for Sidekiq. * * Allows registering jobs that run on a cron schedule. * Only the leader process enqueues periodic jobs to prevent duplicates. */ import type { Config } from "./config.js"; import type { JobConstructor } from "./job.js"; import type { LeaderElector } from "./leader.js"; import type { JobOptions } from "./types.js"; export interface PeriodicJobOptions extends JobOptions { /** Job arguments */ args?: unknown[]; } export interface PeriodicJobConfig { /** Unique identifier for this periodic job */ lid: string; /** Cron expression */ cron: string; /** Job class name */ class: string; /** Target queue */ queue: string; /** Job arguments */ args: unknown[]; /** Additional job options */ options: PeriodicJobOptions; } export declare class PeriodicScheduler { private readonly config; private readonly leaderElector; private readonly jobs; private readonly client; private redis?; private running; private loopPromise?; private stopController?; constructor(config: Config, leaderElector: LeaderElector); /** * Register a periodic job. * * @param cron - Standard 5-field cron expression * @param jobClass - Job class to execute * @param options - Additional job options * @returns The unique lid for this periodic job */ register(cron: string, jobClass: JobConstructor, options?: PeriodicJobOptions): string; /** * Unregister a periodic job by its lid. */ unregister(lid: string): boolean; /** * List all registered periodic jobs. */ list(): PeriodicJobConfig[]; /** * Start the periodic job loop. */ start(): Promise; /** * Stop the periodic job loop. */ stop(): Promise; /** * Generate a deterministic lid for a periodic job. */ private generateLid; /** * Sync registered jobs to Redis for visibility. */ private syncToRedis; /** * Background loop for periodic job scheduling. */ private periodicLoop; /** * Enqueue a periodic job if it hasn't been enqueued recently. */ private enqueueIfNotRecent; } //# sourceMappingURL=periodic.d.ts.map