This commit is contained in:
parent
0ce5b46449
commit
5ecfd81967
4 changed files with 10 additions and 4 deletions
|
@ -328,6 +328,7 @@ type QueuedTask struct {
|
|||
Type constants.TaskType
|
||||
FileID int `json:"file_id"`
|
||||
FileMD5 []byte `json:"file_md5" db:"md5"`
|
||||
FileExtension string `json:"file_extension"`
|
||||
Data json.RawMessage
|
||||
FfmpegCommand types.FFmpegCommand `json:"ffmpeg_command" db:"ffmpeg_command"`
|
||||
}
|
||||
|
@ -344,7 +345,7 @@ func assignQueuedTasks(ctx context.Context) error {
|
|||
assignRunning = false
|
||||
}()
|
||||
|
||||
rows, err := db.Query(ctx, "SELECT t.id as id, t.type as type, t.file_id as file_id, f.md5 as md5, t.data as data, fc.data as ffmpeg_command FROM tasks t INNER JOIN files f ON f.id = t.file_id INNER JOIN ffmpeg_commands fc ON fc.id = t.ffmpeg_command_id WHERE t.status = $1 AND f.status = $2 ORDER BY type DESC", constants.TASK_STATUS_QUEUED, constants.FILE_STATUS_EXISTS)
|
||||
rows, err := db.Query(ctx, "SELECT t.id as id, t.type as type, t.file_id as file_id, f.md5 as md5, substring(f.path FROM '\\.([^\\.]*)$') AS file_extension, t.data as data, fc.data as ffmpeg_command FROM tasks t INNER JOIN files f ON f.id = t.file_id INNER JOIN ffmpeg_commands fc ON fc.id = t.ffmpeg_command_id WHERE t.status = $1 AND f.status = $2 ORDER BY type DESC", constants.TASK_STATUS_QUEUED, constants.FILE_STATUS_EXISTS)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Query Queued Tasks: %w", err)
|
||||
}
|
||||
|
@ -353,6 +354,8 @@ func assignQueuedTasks(ctx context.Context) error {
|
|||
return fmt.Errorf("Collect Queued Tasks: %w", err)
|
||||
}
|
||||
|
||||
// TODO, allow overwriting of extension
|
||||
|
||||
//slog.Info("Assigning Queued Tasks", "count", len(queuedTasks))
|
||||
|
||||
if len(queuedTasks) == 0 {
|
||||
|
@ -406,6 +409,7 @@ func assignQueuedTasks(ctx context.Context) error {
|
|||
Type: queuedTasks[lastAssigned].Type,
|
||||
FileID: queuedTasks[lastAssigned].FileID,
|
||||
FileMD5: queuedTasks[lastAssigned].FileMD5,
|
||||
FileExtension: queuedTasks[lastAssigned].FileExtension,
|
||||
Data: queuedTasks[lastAssigned].Data,
|
||||
FfmpegCommand: queuedTasks[lastAssigned].FfmpegCommand,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue