mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 07:27:40 +00:00
refactor: cron payload migration cleanup (#621)
* refactor: centralize cron payload migration * test: stabilize block streaming mocks * test: adjust chunker fence-close case
This commit is contained in:
committed by
GitHub
parent
e3c340fd38
commit
98d0318d4e
@@ -1,6 +1,7 @@
|
||||
import crypto from "node:crypto";
|
||||
|
||||
import { truncateUtf16Safe } from "../utils.js";
|
||||
import { migrateLegacyCronPayload } from "./payload-migration.js";
|
||||
import { computeNextRunAtMs } from "./schedule.js";
|
||||
import { loadCronStore, saveCronStore } from "./store.js";
|
||||
import type {
|
||||
@@ -320,22 +321,7 @@ export class CronService {
|
||||
|
||||
const payload = raw.payload;
|
||||
if (payload && typeof payload === "object" && !Array.isArray(payload)) {
|
||||
const legacyChannel =
|
||||
typeof (payload as Record<string, unknown>).channel === "string"
|
||||
? String((payload as Record<string, unknown>).channel).trim()
|
||||
: "";
|
||||
const provider =
|
||||
typeof (payload as Record<string, unknown>).provider === "string"
|
||||
? String((payload as Record<string, unknown>).provider).trim()
|
||||
: "";
|
||||
// Back-compat: older cron payloads used `channel` for delivery provider.
|
||||
if (!provider && legacyChannel) {
|
||||
(payload as Record<string, unknown>).provider =
|
||||
legacyChannel.toLowerCase();
|
||||
mutated = true;
|
||||
}
|
||||
if ("channel" in (payload as Record<string, unknown>)) {
|
||||
delete (payload as Record<string, unknown>).channel;
|
||||
if (migrateLegacyCronPayload(payload as Record<string, unknown>)) {
|
||||
mutated = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user