-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(server): transcodes failing due to storage migration happening simultaneously #3071
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import { AssetType } from '@app/infra/entities'; | ||
import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common'; | ||
import { IAssetRepository, mapAsset } from '../asset'; | ||
import { CommunicationEvent, ICommunicationRepository } from '../communication'; | ||
|
@@ -163,9 +164,15 @@ export class JobService { | |
await this.jobRepository.queue({ name: JobName.CLASSIFY_IMAGE, data: item.data }); | ||
await this.jobRepository.queue({ name: JobName.ENCODE_CLIP, data: item.data }); | ||
await this.jobRepository.queue({ name: JobName.RECOGNIZE_FACES, data: item.data }); | ||
if (item.data.source !== 'upload') { | ||
break; | ||
} | ||
|
||
const [asset] = await this.assetRepository.getByIds([item.data.id]); | ||
if (asset) { | ||
if (asset.type === AssetType.VIDEO) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you give a more explanation on why moving the job here would help with race conditions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently metadata extraction and transcoding are queued at the same time. Since metadata extraction is followed by migration, this can cause transcoding to fail. But since thumbnail generation is queued only after migration, there's no longer any risk of a race condition. |
||
await this.jobRepository.queue({ name: JobName.VIDEO_CONVERSION, data: item.data }); | ||
} | ||
this.communicationRepository.send(CommunicationEvent.UPLOAD_SUCCESS, asset.ownerId, mapAsset(asset)); | ||
} | ||
break; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for this check here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Videos are currently only automatically queued for transcoding on upload, not when any other job is run. This check is to maintain that behavior. The asset check in this section also seems specific to uploading.