@sidequest/engine
Version:
@sidequest/engine is the core engine of SideQuest, a distributed background job processing system for Node.js and TypeScript.
40 lines (37 loc) • 1.68 kB
TypeScript
import { EngineConfig } from '../engine.js';
declare class MainWorker {
shuttingDown: boolean;
private dispatcher;
private engine;
private backend?;
/**
* Starts a Sidequest worker process with the given configuration.
* @param sidequestConfig The Sidequest configuration for the worker.
*/
runWorker(sidequestConfig: EngineConfig): Promise<void>;
/**
* Gracefully shuts down the worker and releases resources.
*/
shutdown(): Promise<void>;
/**
* Starts cron job for releasing stale jobs.
* Also executes the task immediately.
*/
startAndExecuteStaleJobsReleaseCron(intervalMin: number, maxStaleMs: number, maxClaimedMs: number): Promise<unknown>;
/**
* Starts cron job for cleaning up finished jobs.
* Also executes the task immediately.
*/
startAndExecuteFinishedJobsCleanupCron(intervalMin: number, cutoffMs: number): Promise<unknown>;
/**
* Starts cron jobs for releasing stale jobs and cleaning up finished jobs.
*
* @param staleIntervalMin Interval in minutes for releasing stale jobs, or false to disable.
* @param maxStaleMs Maximum age in milliseconds for stale jobs.
* @param maxClaimedMs Maximum age in milliseconds for claimed jobs.
* @param cleanupIntervalMin Interval in minutes for cleaning up finished jobs, or false to disable
* @param cleanupCutoffMs Maximum age in milliseconds for finished jobs to be cleaned up.
*/
startCron(staleIntervalMin: number | false, maxStaleMs: number, maxClaimedMs: number, cleanupIntervalMin: number | false, cleanupCutoffMs: number): Promise<void>;
}
export { MainWorker };