import { after } from "next/server";
import { runBackgroundJob } from "./runner";

/** 在 API 回應後於伺服器背景執行任務（離開頁面也不會中斷） */
export function scheduleBackgroundJob(jobId: string) {
  after(async () => {
    await runBackgroundJob(jobId);
  });
}