mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Support studio transcoding in peertube runner
This commit is contained in:
parent
6a49056026
commit
5e47f6ab98
67 changed files with 1423 additions and 262 deletions
|
@ -1,6 +1,4 @@
|
|||
|
||||
import { JOB_PRIORITY } from '@server/initializers/constants'
|
||||
import { VideoModel } from '@server/models/video/video'
|
||||
import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models'
|
||||
|
||||
export abstract class AbstractJobBuilder {
|
||||
|
@ -20,20 +18,4 @@ export abstract class AbstractJobBuilder {
|
|||
isNewVideo: boolean
|
||||
user: MUserId | null
|
||||
}): Promise<any>
|
||||
|
||||
protected async getTranscodingJobPriority (options: {
|
||||
user: MUserId
|
||||
fallback: number
|
||||
}) {
|
||||
const { user, fallback } = options
|
||||
|
||||
if (!user) return fallback
|
||||
|
||||
const now = new Date()
|
||||
const lastWeek = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 7)
|
||||
|
||||
const videoUploadedByUser = await VideoModel.countVideosUploadedByUserSince(user.id, lastWeek)
|
||||
|
||||
return JOB_PRIORITY.TRANSCODING + videoUploadedByUser
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue