Skip to content
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
6 changes: 6 additions & 0 deletions pkg/loop/settings.go
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated supporting change included here to reduce noise and version bumps.

Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ func (a *AtomicSettings) Unsubscribe(ch <-chan core.SettingsUpdate) {
}
}

func (a *AtomicSettings) Load() (core.SettingsUpdate, error) {
a.mu.RLock()
defer a.mu.RUnlock()
return *a.current, nil
}

func (a *AtomicSettings) Store(update core.SettingsUpdate) error {
getter, err := settings.NewTOMLGetter([]byte(update.Settings))
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions pkg/settings/limits/rate.go
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error field was being set, but from another unset field.

Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ func (l *rateLimiter) WaitN(ctx context.Context, n int) error {

func (f Factory) newScopedRateLimiter(limit settings.Setting[config.Rate]) (RateLimiter, error) {
l := &scopedRateLimiter{
key: limit.Key,
scope: limit.Scope,
defaultRate: limit.DefaultValue,
}
Expand Down Expand Up @@ -373,6 +374,7 @@ func (f Factory) newScopedRateLimiter(limit settings.Setting[config.Rate]) (Rate

type scopedRateLimiter struct {
lggr logger.Logger
key string
scope settings.Scope
defaultRate config.Rate

Expand Down Expand Up @@ -432,6 +434,7 @@ func (s *scopedRateLimiter) getOrCreate(ctx context.Context) (RateLimiter, func(

func (s *scopedRateLimiter) newRateLimiter(tenant string) *rateLimiter {
l := &rateLimiter{
key: s.key,
scope: s.scope,
tenant: tenant,
updater: newUpdater[config.Rate](logger.With(s.lggr, s.scope.String(), tenant), s.rateFn, s.subFn),
Expand Down
Loading