mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 23:18:28 +00:00
chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -22,36 +22,24 @@ export type GatewayCronState = {
|
||||
export function buildGatewayCronService(params: {
|
||||
cfg: ReturnType<typeof loadConfig>;
|
||||
deps: CliDeps;
|
||||
broadcast: (
|
||||
event: string,
|
||||
payload: unknown,
|
||||
opts?: { dropIfSlow?: boolean },
|
||||
) => void;
|
||||
broadcast: (event: string, payload: unknown, opts?: { dropIfSlow?: boolean }) => void;
|
||||
}): GatewayCronState {
|
||||
const cronLogger = getChildLogger({ module: "cron" });
|
||||
const storePath = resolveCronStorePath(params.cfg.cron?.store);
|
||||
const cronEnabled =
|
||||
process.env.CLAWDBOT_SKIP_CRON !== "1" &&
|
||||
params.cfg.cron?.enabled !== false;
|
||||
const cronEnabled = process.env.CLAWDBOT_SKIP_CRON !== "1" && params.cfg.cron?.enabled !== false;
|
||||
|
||||
const resolveCronAgent = (requested?: string | null) => {
|
||||
const runtimeConfig = loadConfig();
|
||||
const normalized =
|
||||
typeof requested === "string" && requested.trim()
|
||||
? normalizeAgentId(requested)
|
||||
: undefined;
|
||||
typeof requested === "string" && requested.trim() ? normalizeAgentId(requested) : undefined;
|
||||
const hasAgent =
|
||||
normalized !== undefined &&
|
||||
Array.isArray(runtimeConfig.agents?.list) &&
|
||||
runtimeConfig.agents.list.some(
|
||||
(entry) =>
|
||||
entry &&
|
||||
typeof entry.id === "string" &&
|
||||
normalizeAgentId(entry.id) === normalized,
|
||||
entry && typeof entry.id === "string" && normalizeAgentId(entry.id) === normalized,
|
||||
);
|
||||
const agentId = hasAgent
|
||||
? normalized
|
||||
: resolveDefaultAgentId(runtimeConfig);
|
||||
const agentId = hasAgent ? normalized : resolveDefaultAgentId(runtimeConfig);
|
||||
return { agentId, cfg: runtimeConfig };
|
||||
};
|
||||
|
||||
@@ -106,10 +94,7 @@ export function buildGatewayCronService(params: {
|
||||
durationMs: evt.durationMs,
|
||||
nextRunAtMs: evt.nextRunAtMs,
|
||||
}).catch((err) => {
|
||||
cronLogger.warn(
|
||||
{ err: String(err), logPath },
|
||||
"cron: run log append failed",
|
||||
);
|
||||
cronLogger.warn({ err: String(err), logPath }, "cron: run log append failed");
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user