Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use config value for max upload queue size #772

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/config/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type BaseConfig struct {
BackupStorage string `yaml:"backup_storage"` // backup file location for failed uploads
ClusterID string `yaml:"cluster_id"` // cluster this instance belongs to
EnableChromeSandbox bool `yaml:"enable_chrome_sandbox"` // enable Chrome sandbox, requires extra docker configuration
MaxUploadQueue int `yaml:"max_upload_queue"` // maximum upload queue size, in minutes
StorageConfig `yaml:",inline"` // upload config (S3, Azure, GCP, or AliOSS)
SessionLimits `yaml:"session_limits"` // session duration limits

Expand Down
4 changes: 4 additions & 0 deletions pkg/config/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
trackCpuCost = 0.5
maxCpuUtilization = 0.8
maxConcurrentWeb = 18
maxUploadQueue = 60

defaultTemplatePort = 7980
defaultTemplateBaseTemplate = "http://localhost:%d/"
Expand Down Expand Up @@ -115,6 +116,9 @@ func NewServiceConfig(confString string) (*ServiceConfig, error) {
if conf.MaxConcurrentWeb <= 0 {
conf.MaxConcurrentWeb = maxConcurrentWeb
}
if conf.MaxUploadQueue <= 0 {
conf.MaxUploadQueue = maxUploadQueue
}

if conf.TemplateBase == "" {
conf.TemplateBase = fmt.Sprintf(defaultTemplateBaseTemplate, conf.TemplatePort)
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/sink/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type imageUpdate struct {
}

func newImageSink(u uploader.Uploader, p *config.PipelineConfig, o *config.ImageConfig, callbacks *gstreamer.Callbacks) (*ImageSink, error) {
maxPendingUploads := 900 / o.CaptureInterval
maxPendingUploads := (p.MaxUploadQueue * 60) / int(o.CaptureInterval)
return &ImageSink{
Uploader: u,
ImageConfig: o,
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/sink/segments.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func newSegmentSink(u uploader.Uploader, p *config.PipelineConfig, o *config.Seg
outputType = types.OutputTypeTS
}

maxPendingUploads := 900 / o.SegmentDuration
maxPendingUploads := (p.MaxUploadQueue * 60) / o.SegmentDuration
s := &SegmentSink{
Uploader: u,
SegmentConfig: o,
Expand Down