Skip to content

Commit

Permalink
fix tier2 max concurrent request configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
colindickson committed Mar 12, 2024
1 parent 4999381 commit 152e2bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/tier2.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ func (a *Tier2App) Run() error {
opts = append(opts, service.WithModuleExecutionTracing())
}

if a.config.MaximumConcurrentRequests > 0 {
opts = append(opts, service.WithMaxConcurrentRequests(a.config.MaximumConcurrentRequests))
}
opts = append(opts, service.WithReadinessFunc(a.setReadiness))

svc, err := service.NewTier2(
Expand Down
12 changes: 12 additions & 0 deletions service/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ func WithModuleExecutionTracing() Option {
}
}

func WithMaxConcurrentRequests(max uint64) Option {
return func(a anyTierService) {
switch s := a.(type) {
case *Tier1Service:
// not used
case *Tier2Service:
s.runtimeConfig.MaxConcurrentRequests = int64(max)
}
}

}

func WithReadinessFunc(f func(bool)) Option {
return func(a anyTierService) {
switch s := a.(type) {
Expand Down

0 comments on commit 152e2bd

Please sign in to comment.