Add backend log management
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
} from "@/lib/server/data-store";
|
||||
import { advanceImageJob } from "@/lib/server/generation-service";
|
||||
import { advanceVideoJob } from "@/lib/server/video-generation-service";
|
||||
import { recordAppLog } from "@/lib/server/log-manager";
|
||||
import { requestOrigin } from "@/lib/server/runtime";
|
||||
import { deliverJobWebhook } from "@/lib/server/webhook";
|
||||
import type { GenerationJob, GenerationStatus } from "@/lib/types";
|
||||
@@ -53,6 +54,19 @@ export async function runWorkerTick(input: {
|
||||
action: settled.action
|
||||
});
|
||||
} catch (error) {
|
||||
await recordAppLog({
|
||||
level: "error",
|
||||
source: "worker.job",
|
||||
message: `任务处理失败:${job.id}`,
|
||||
error,
|
||||
details: {
|
||||
jobId: job.id,
|
||||
capability: job.capability,
|
||||
provider: job.provider,
|
||||
attempts: job.attempts,
|
||||
workerId
|
||||
}
|
||||
}).catch(() => undefined);
|
||||
const failed = await updateGenerationJob(job.id, {
|
||||
status: "failed",
|
||||
error: {
|
||||
|
||||
Reference in New Issue
Block a user