diff options
author | 2024-08-03 16:40:26 +0200 | |
---|---|---|
committer | 2024-08-03 16:40:26 +0200 | |
commit | fa59c3713c14bd1463b923d57a57a914622626d7 (patch) | |
tree | 255f4e4995fb308da9f2e0f0377ede02089ebff3 /internal | |
parent | [chore/frontend] Update namerole rendering on skinny devices (#3166) (diff) | |
download | gotosocial-fa59c3713c14bd1463b923d57a57a914622626d7.tar.xz |
[chore] Add `media-ffmpeg-pool-size` config var (#3164)
Diffstat (limited to 'internal')
-rw-r--r-- | internal/config/config.go | 1 | ||||
-rw-r--r-- | internal/config/defaults.go | 1 | ||||
-rw-r--r-- | internal/config/helpers.gen.go | 25 |
3 files changed, 27 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index bba284d56..79f74cf71 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -101,6 +101,7 @@ type Configuration struct { MediaRemoteMaxSize bytesize.Size `name:"media-remote-max-size" usage:"Max size in bytes of media to download from other instances"` MediaCleanupFrom string `name:"media-cleanup-from" usage:"Time of day from which to start running media cleanup/prune jobs. Should be in the format 'hh:mm:ss', eg., '15:04:05'."` MediaCleanupEvery time.Duration `name:"media-cleanup-every" usage:"Period to elapse between cleanups, starting from media-cleanup-at."` + MediaFfmpegPoolSize int `name:"media-ffmpeg-pool-size" usage:"Number of instances of the embedded ffmpeg WASM binary to add to the media processing pool. 0 or less uses GOMAXPROCS."` StorageBackend string `name:"storage-backend" usage:"Storage backend to use for media attachments"` StorageLocalBasePath string `name:"storage-local-base-path" usage:"Full path to an already-created directory where gts should store/retrieve media files. Subfolders will be created within this dir."` diff --git a/internal/config/defaults.go b/internal/config/defaults.go index d16df6802..7728b4a7f 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -80,6 +80,7 @@ var Defaults = Configuration{ MediaEmojiRemoteMaxSize: 100 * bytesize.KiB, MediaCleanupFrom: "00:00", // Midnight. MediaCleanupEvery: 24 * time.Hour, // 1/day. + MediaFfmpegPoolSize: 1, StorageBackend: "local", StorageLocalBasePath: "/gotosocial/storage", diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index 7523f17ad..d75956963 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -1300,6 +1300,31 @@ func GetMediaCleanupEvery() time.Duration { return global.GetMediaCleanupEvery() // SetMediaCleanupEvery safely sets the value for global configuration 'MediaCleanupEvery' field func SetMediaCleanupEvery(v time.Duration) { global.SetMediaCleanupEvery(v) } +// GetMediaFfmpegPoolSize safely fetches the Configuration value for state's 'MediaFfmpegPoolSize' field +func (st *ConfigState) GetMediaFfmpegPoolSize() (v int) { + st.mutex.RLock() + v = st.config.MediaFfmpegPoolSize + st.mutex.RUnlock() + return +} + +// SetMediaFfmpegPoolSize safely sets the Configuration value for state's 'MediaFfmpegPoolSize' field +func (st *ConfigState) SetMediaFfmpegPoolSize(v int) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.MediaFfmpegPoolSize = v + st.reloadToViper() +} + +// MediaFfmpegPoolSizeFlag returns the flag name for the 'MediaFfmpegPoolSize' field +func MediaFfmpegPoolSizeFlag() string { return "media-ffmpeg-pool-size" } + +// GetMediaFfmpegPoolSize safely fetches the value for global configuration 'MediaFfmpegPoolSize' field +func GetMediaFfmpegPoolSize() int { return global.GetMediaFfmpegPoolSize() } + +// SetMediaFfmpegPoolSize safely sets the value for global configuration 'MediaFfmpegPoolSize' field +func SetMediaFfmpegPoolSize(v int) { global.SetMediaFfmpegPoolSize(v) } + // GetStorageBackend safely fetches the Configuration value for state's 'StorageBackend' field func (st *ConfigState) GetStorageBackend() (v string) { st.mutex.RLock() |