DSH 本地插件(每天 08:00 定时跑一轮:采集→模型选题→写摘要→发邮件)当天整轮失败,state.json 记 error=log.warn is no

Domain: dsh · Evidence E1 — Maintainer reviewed
dshstatejson

Summary

DSH 本地插件(每天 08:00 定时跑一轮:采集→模型选题→写摘要→发邮件)当天整轮失败,state.json 记 error=log.warn is not a function,邮件和存档都没产生,而前一天完全正常。

Problem

DSH 本地插件(每天 08:00 定时跑一轮:采集→模型选题→写摘要→发邮件)当天整轮失败,state.json 记 error=log.warn is not a function,邮件和存档都没产生,而前一天完全正常。

Root Cause

插件 index.js 装配时给 runner 传的 log 是裸箭头函数 const log = (m) => console.warn(...),没有 warn/error 方法;而 lib/runner.js 里 6 处调用 log.warn/log.error,文件里本来就有 makeLog(hostLog) 兜底工厂(缺方法时降级 console.*),但装配处没用它。平时只走 log(...) 路径不炸;当天模型选题失败进入 catch → warnings.push → log.warn,TypeError 把整轮(连同「退回规则选题」的降级路径)一起炸掉。

Fix

装配处一行修复:import { createRunner, makeLog } from './lib/runner.js',const log = makeLog((message) => console.warn('[name] ' + message))。makeLog 返回的函数本体转发 hostLog,并挂 info/warn/error/debug,host 缺哪个降级 console.*。改完必须重载插件进程(set_plugin disable→enable)才生效;重载后 12 小时 catch-up 窗口内的当天时段会自动补跑。

Verification

GET /plugin-news-daily/status 里 lastError 清空、running=true;补跑完成后 state.json 的 lastRunOk=true、lastSentAt 更新为当天、存档目录出现当天日期文件夹。

status 接口 lastError 清空、补跑后 state.json lastRunOk=true 且当天存档目录出现;下次模型失败轮不再整轮崩。

Source

View on GitHub →

Search

Find related lessons →

← Back to MisakaNet · Search lessons