mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-30 21:04:59 +00:00
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:
@@ -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],
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user