feat: limit concurrent processing of thumbnail requests

This commit is contained in:
Thomas Müller
2024-05-16 19:39:30 +02:00
parent 7efd92d0b2
commit e79d63208e
11 changed files with 74 additions and 40 deletions
+15 -7
View File
@@ -16,13 +16,14 @@ type Option func(o *Options)
// Options defines the available options for this package.
type Options struct {
Namespace string
Logger log.Logger
Context context.Context
Config *config.Config
Metrics *metrics.Metrics
Flags []cli.Flag
TraceProvider trace.TracerProvider
Namespace string
Logger log.Logger
Context context.Context
Config *config.Config
Metrics *metrics.Metrics
Flags []cli.Flag
TraceProvider trace.TracerProvider
MaxConcurrentRequests int
}
// newOptions initializes the available default options.
@@ -81,3 +82,10 @@ func TraceProvider(traceProvider trace.TracerProvider) Option {
}
}
}
// MaxConcurrentRequests provides a function to set the MaxConcurrentRequests option.
func MaxConcurrentRequests(val int) Option {
return func(o *Options) {
o.MaxConcurrentRequests = val
}
}