Skip to content

Commit

Permalink
Log for start and end of processing a file
Browse files Browse the repository at this point in the history
  • Loading branch information
cant-code committed Mar 29, 2024
1 parent 43f0ef2 commit 6e5a71c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions internal/consumer/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func Consume(dependency *dependency.Dependency) {
msg := <-sub.C

if msg != nil {
log.Println("Received message from queue")
go RunJob(msg, dependency)
}
}
Expand Down
4 changes: 4 additions & 0 deletions internal/consumer/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ func RunJob(msg *stomp.Message, dependency *dependency.Dependency) {
return
}

log.Println("Received file to transcode with id: ", value.FileId)

var id int64
err = dependency.DBConn.QueryRow(insertQuery, value.FileId, Started.string()).Scan(&id)
if err != nil {
Expand Down Expand Up @@ -126,6 +128,8 @@ func RunJob(msg *stomp.Message, dependency *dependency.Dependency) {
if err != nil {
log.Println(err)
}

log.Println("Finished processing for fileId: ", value.FileId)
}

func encodeVideoAndUploadToS3(target int, object string, channel chan EncoderResponse, dependency *dependency.Dependency) {
Expand Down
3 changes: 1 addition & 2 deletions internal/encoder/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package encoder

import (
"fmt"
"log"
"os/exec"
"time"
)
Expand All @@ -14,7 +13,7 @@ func EncodeVideo(input string, target int) (string, error) {
"-c:v", "libx264", "-crf", "18", "-preset", "veryslow",
"-c:a", "copy", fmt.Sprintf("./files/%s", key))

cmd.Stderr = log.Writer()
cmd.Stdout = nil

err := cmd.Run()
if err != nil {
Expand Down

0 comments on commit 6e5a71c

Please sign in to comment.