[chore] Add media-ffmpeg-pool-size config var (#3164)

This commit is contained in:
tobi 2024-08-03 16:40:26 +02:00 committed by GitHub
commit fa59c3713c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 77 additions and 4 deletions

View file

@ -487,16 +487,24 @@ func setLimits(ctx context.Context) {
}
func precompileWASM(ctx context.Context) error {
// TODO: make max number instances configurable
maxprocs := runtime.GOMAXPROCS(0)
if err := sqlite3.Initialize(); err != nil {
return gtserror.Newf("error compiling sqlite3: %w", err)
}
if err := ffmpeg.InitFfmpeg(ctx, maxprocs); err != nil {
// Use admin-set ffmpeg pool size, and fall
// back to GOMAXPROCS if number 0 or less.
ffPoolSize := config.GetMediaFfmpegPoolSize()
if ffPoolSize <= 0 {
ffPoolSize = runtime.GOMAXPROCS(0)
}
if err := ffmpeg.InitFfmpeg(ctx, ffPoolSize); err != nil {
return gtserror.Newf("error compiling ffmpeg: %w", err)
}
if err := ffmpeg.InitFfprobe(ctx, maxprocs); err != nil {
if err := ffmpeg.InitFfprobe(ctx, ffPoolSize); err != nil {
return gtserror.Newf("error compiling ffprobe: %w", err)
}
return nil
}