refactor(transcode): offload video embedding chunk slicing to transcode queue (#539)

* refactor(transcode): offload video embedding chunk slicing to transcode queue

* fix(transcode): address video chunk offloading review findings
This commit is contained in:
Yiling-J
2026-11-22 11:52:58 +08:00
committed by GitHub
parent 3943407093
commit aabf59cbe7
23 changed files with 1226 additions and 434 deletions
@@ -166,6 +166,15 @@ describe('EmbeddingService', () => {
projectId: project.id,
},
})
const staleChunkTask = await prisma.workflowTask.create({
data: {
assetId: videoAsset.id,
type: WorkflowTaskType.transcode_video_chunks,
status: WorkflowTaskStatus.processing,
teamId: team.id,
projectId: project.id,
},
})
const initialEmbeddings = await prisma.assetEmbedding.count({
where: { assetId: videoAsset.id },
@@ -179,6 +188,12 @@ describe('EmbeddingService', () => {
expect(result.tasksCreated).toBe(3)
expect(result.skippedTeams).not.toContain('Active Embedding Team')
// Verify old transcode_video_chunks task was also wiped upfront
const remainingChunkTask = await prisma.workflowTask.findUnique({
where: { id: staleChunkTask.id },
})
expect(remainingChunkTask).toBeNull()
// Verify old embeddings were wiped upfront
const remainingEmbeddings = await prisma.assetEmbedding.count({
where: { assetId: videoAsset.id },
@@ -80,7 +80,9 @@ export class EmbeddingService {
await prisma.workflowTask.deleteMany({
where: {
assetId: { in: eligibleAssetIds },
type: WorkflowTaskType.ai_embedding,
type: {
in: [WorkflowTaskType.ai_embedding, WorkflowTaskType.transcode_video_chunks],
},
},
})