Trigger.dev란
서버리스 환경에서 긴 실행 시간이 필요한 백그라운드 작업을 안정적으로 처리합니다.
작업 정의
import { task } from "@trigger.dev/sdk/v3";
export const processVideo = task({
id: "process-video",
maxDuration: 300,
retry: { maxAttempts: 3 },
run: async (payload: { videoUrl: string }) => {
const video = await downloadVideo(payload.videoUrl);
const thumbnail = await generateThumbnail(video);
const transcript = await transcribe(video);
return { thumbnail, transcript };
},
});
// 트리거
await processVideo.trigger({ videoUrl: "https://..." });Next.js, Remix 등 모든 프레임워크에서 사용 가능합니다.
댓글 0