@@ -152,7 +152,7 @@ type waiter[N Number] struct {
152152}
153153
154154type resourcePoolUsage [N Number ] struct {
155- * resourcePoolLimiter [N ]
155+ resourcePoolLimiter [N ]
156156 scope settings.Scope // optional
157157 tenant string // optional
158158 mu sync.Mutex
@@ -185,10 +185,9 @@ func (u *resourcePoolUsage[N]) onLimitUpdate() {
185185
186186func (l * resourcePoolLimiter [N ]) newLimitUsage (opts ... metric.RecordOption ) * resourcePoolUsage [N ] {
187187 u := resourcePoolUsage [N ]{
188- resourcePoolLimiter : l ,
189- queue : make ([]* waiter [N ], 0 ),
190- stopCh : make (services.StopChan ),
191- done : make (chan struct {}),
188+ queue : make ([]* waiter [N ], 0 ),
189+ stopCh : make (services.StopChan ),
190+ done : make (chan struct {}),
192191 recordUsage : func (ctx context.Context , n N ) {
193192 if l .recordUsage != nil {
194193 l .recordUsage (ctx , n , opts ... )
@@ -215,6 +214,9 @@ func (l *resourcePoolLimiter[N]) newLimitUsage(opts ...metric.RecordOption) *res
215214 }
216215 },
217216 }
217+ // copy but replace updater
218+ u .resourcePoolLimiter = * l
219+ u .resourcePoolLimiter .updater = newUpdater (l .lggr , l .getLimitFn , l .subFn )
218220 return & u
219221}
220222
@@ -384,8 +386,6 @@ func newUnscopedResourcePoolLimiter[N Number](defaultLimit N) *unscopedResourceP
384386 return l
385387}
386388
387- func recordNoop [T any ](ctx context.Context , value T ) {}
388-
389389func (u * unscopedResourcePoolLimiter [N ]) Limit (ctx context.Context ) (N , error ) {
390390 return u .get (ctx )
391391}
0 commit comments