Config repository (#3988)
* WIP * fix(test): fix ap test failing * fix: fix unkeyed fields being used * chore(tests): clean up browser tests by splitting out federation UI tests
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/persistence/configrepository"
|
||||
"github.com/owncast/owncast/utils"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
@@ -64,9 +64,9 @@ func NewS3Storage() *S3Storage {
|
||||
// Setup sets up the s3 storage for saving the video to s3.
|
||||
func (s *S3Storage) Setup() error {
|
||||
log.Trace("Setting up S3 for external storage of video...")
|
||||
|
||||
s3Config := data.GetS3Config()
|
||||
customVideoServingEndpoint := data.GetVideoServingEndpoint()
|
||||
configRepository := configrepository.Get()
|
||||
s3Config := configRepository.GetS3Config()
|
||||
customVideoServingEndpoint := configRepository.GetVideoServingEndpoint()
|
||||
|
||||
if customVideoServingEndpoint != "" {
|
||||
s.host = customVideoServingEndpoint
|
||||
@@ -106,8 +106,9 @@ func (s *S3Storage) SegmentWritten(localFilePath string) {
|
||||
averagePerformance := utils.GetAveragePerformance(performanceMonitorKey)
|
||||
|
||||
// Warn the user about long-running save operations
|
||||
configRepository := configrepository.Get()
|
||||
if averagePerformance != 0 {
|
||||
if averagePerformance > float64(data.GetStreamLatencyLevel().SecondsPerSegment)*0.9 {
|
||||
if averagePerformance > float64(configRepository.GetStreamLatencyLevel().SecondsPerSegment)*0.9 {
|
||||
log.Warnln("Possible slow uploads: average upload S3 save duration", averagePerformance, "s. troubleshoot this issue by visiting https://owncast.online/docs/troubleshooting/")
|
||||
}
|
||||
}
|
||||
@@ -220,7 +221,8 @@ func (s *S3Storage) Cleanup() error {
|
||||
// RemoteCleanup will remove old files from the remote storage provider.
|
||||
func (s *S3Storage) RemoteCleanup() error {
|
||||
// Determine how many files we should keep on S3 storage
|
||||
maxNumber := data.GetStreamLatencyLevel().SegmentCount
|
||||
configRepository := configrepository.Get()
|
||||
maxNumber := configRepository.GetStreamLatencyLevel().SegmentCount
|
||||
buffer := 20
|
||||
|
||||
keys, err := s.getDeletableVideoSegmentsWithOffset(maxNumber + buffer)
|
||||
|
||||
Reference in New Issue
Block a user