Skip to content

Commit

Permalink
Use more transcode workers on larger machines (#7363)
Browse files Browse the repository at this point in the history
  • Loading branch information
stereosteve authored Feb 16, 2024
1 parent d4dab56 commit 25d45fa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mediorum/server/transcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"log"
"os"
"os/exec"
"runtime"
"strings"
"sync"
"time"
Expand All @@ -34,7 +35,12 @@ var (
func (ss *MediorumServer) startTranscoder() {
myHost := ss.Config.Self.Host
work := make(chan *Upload)
numWorkers := 2

// use most cpus for transcode
numWorkers := runtime.NumCPU() - 2
if numWorkers < 2 {
numWorkers = 2
}

// on boot... reset any of my wip jobs
for _, statuses := range [][]string{{JobStatusBusy, JobStatusNew}, {JobStatusBusyRetranscode, JobStatusRetranscode}} {
Expand Down

0 comments on commit 25d45fa

Please sign in to comment.