@vendure/core
Version:
A modern, headless ecommerce framework
28 lines (27 loc) • 1.03 kB
TypeScript
import { TransactionalConnection } from '../../connection/transactional-connection';
import { ScheduledTask } from '../../scheduler';
/**
* @description
* This service finds and cleans stale locks, which can occur if a worker instance is
* non-gracefully shut down while a task is ongoing, and the lock is never released.
*
* Failure to clean these stale locks will prevent the task from ever running again, since
* workers will assume it is locked by another processes and will ignore it.
*/
export declare class StaleTaskService {
private connection;
private taskIntervalMap;
constructor(connection: TransactionalConnection);
/**
* @description
* Cleans stale task locks from the database.
*/
cleanStaleLocksForTask(task: ScheduledTask): Promise<void>;
private fetchLockedTask;
/**
* Returns the interval in ms between one run of the task, and the next.
*/
getScheduleIntervalMs(task: ScheduledTask): number;
private isStale;
private clearStaleLock;
}