mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
refactor(cron): keep receipt hooks internal
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import type { CronStoreTransactionHooks } from "../store.js";
|
||||
import {
|
||||
assertCronRunReceiptCurrent,
|
||||
assertCronRunReceiptCurrentInDatabase,
|
||||
@@ -9,6 +8,7 @@ import {
|
||||
type CronRunReceiptHandle,
|
||||
type CronRunReceiptStatus,
|
||||
} from "../store/run-receipt-store.js";
|
||||
import type { CronStoreTransactionHooks } from "../store/transaction-hooks.js";
|
||||
import type { CronJob, CronRunStatus } from "../types.js";
|
||||
import { resolveEffectiveJobAgentId } from "./ops-shared.js";
|
||||
import type { CronServiceState } from "./state.js";
|
||||
|
||||
@@ -9,9 +9,9 @@ import {
|
||||
getCronJobsStoreRevision,
|
||||
loadCronJobsStoreWithConfigJobs,
|
||||
saveCronJobsStore,
|
||||
type CronStoreTransactionHooks,
|
||||
type QuarantinedCronConfigJob,
|
||||
} from "../store.js";
|
||||
import type { CronStoreTransactionHooks } from "../store/transaction-hooks.js";
|
||||
import type { CronJob, CronStoreFile } from "../types.js";
|
||||
import { computeJobNextRunAtMs, recomputeNextRuns } from "./jobs-scheduling.js";
|
||||
import { assertTimeScheduleSatisfiable } from "./jobs-validation.js";
|
||||
|
||||
+1
-7
@@ -28,6 +28,7 @@ import {
|
||||
repairCronRuntimeAuthorityRows,
|
||||
replaceCronRuntimeAuthorityRows,
|
||||
} from "./store/runtime-authority-store.js";
|
||||
import type { CronStoreTransactionHooks } from "./store/transaction-hooks.js";
|
||||
import type {
|
||||
CronQuarantinedJob,
|
||||
LoadedCronStore,
|
||||
@@ -236,13 +237,6 @@ type SaveCronStoreOptions = {
|
||||
stateOnly?: boolean;
|
||||
};
|
||||
|
||||
export type CronStoreTransactionHooks = {
|
||||
/** Runs inside the authoritative write transaction before cron rows change. */
|
||||
beforeWrite?: (db: DatabaseSync) => void;
|
||||
/** Runs after row changes but before the same transaction commits. */
|
||||
afterWrite?: (db: DatabaseSync) => void;
|
||||
};
|
||||
|
||||
type SaveCronJobsStoreOptions = SaveCronStoreOptions & {
|
||||
quarantine?: {
|
||||
entries: readonly (QuarantinedCronConfigJob | CronQuarantinedJob)[];
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { DatabaseSync } from "node:sqlite";
|
||||
|
||||
export type CronStoreTransactionHooks = {
|
||||
beforeWrite?: (db: DatabaseSync) => void;
|
||||
afterWrite?: (db: DatabaseSync) => void;
|
||||
};
|
||||
Reference in New Issue
Block a user