/** * Runs recurring cron jobs through cluster sharding. * * This module turns a `Cron.Cron` schedule into a `Layer` that coordinates one * recurring job across a cluster. It registers a singleton for the initial * scheduling step and a persisted entity message for each run. This is useful * for distributed maintenance work where the job should be owned by the cluster * rather than by every runner independently. * * With `calculateNextRunFromPrevious`, every run is processed by a single * entity per cron job, so runs never overlap and are caught up in order. The * scheduled time of the current run is available through * `CurrentScheduledTime`. * * @stability unstable * @since 4.0.0 */ import * as Context from "../Context.ts"; import * as Cron from "../Cron.ts"; import * as DateTime from "../DateTime.ts"; import * as Duration from "../Duration.ts"; import * as Effect from "../Effect.ts"; import * as Layer from "../Layer.ts"; import type { Scope } from "../Scope.ts"; import type { Sharding } from "./Sharding.ts"; declare const CurrentScheduledTime_base: Context.ServiceClass; /** * Service tag for the scheduled time of the cron run currently executing. * * **When to use** * * Use to read the time the current run was scheduled for, inside the * `execute` effect of `make`. * * @stability unstable * @category services * @since 4.0.0 */ export declare class CurrentScheduledTime extends CurrentScheduledTime_base { } /** * Creates a layer that runs a cron job through the cluster sharding system. * * **Details** * * The job is scheduled as persisted entity messages, with an initial singleton * scheduling step and optional controls for shard group, next-run calculation, * and skipping stale scheduled runs. * * @stability unstable * @category constructors * @since 4.0.0 */ export declare const make: (options: { readonly name: string; readonly cron: Cron.Cron; readonly execute: Effect.Effect; /** * Choose a shard group to run this cron job on. */ readonly shardGroup?: string | undefined; /** * Controls whether the next cron job is based on the time of the previous * run. * * **Details** * * Defaults to `false`, meaning the next run will be calculated from the * current time. * * When enabled, all runs are processed one at a time by a single entity, so * missed runs are caught up in order without overlapping. A run that fails * is retried in place and blocks later runs until it succeeds or is older * than `skipIfOlderThan`. */ readonly calculateNextRunFromPrevious?: boolean | undefined; /** * If set, the cron job will skip execution if the scheduled time is older * than this duration. * * **When to use** * * Use to prevent running jobs that were scheduled too far in the past. * * **Details** * * Defaults to "1 day". */ readonly skipIfOlderThan?: Duration.Input | undefined; }) => Layer.Layer, Scope>>; export {}; //# sourceMappingURL=ClusterCron.d.ts.map