governor icon indicating copy to clipboard operation
governor copied to clipboard

How to know RateLimiter inner Quota

Open baoyachi opened this issue 1 year ago • 2 comments

baoyachi avatar Aug 28 '23 02:08 baoyachi

That's a tricky question: To save space, the RateLimiter struct doesn't retain a reference to the Quota (instead, representing the quota in its Gcra elements T and Tau. If you wish to refer back to the Quota, it's probably best to hold on to the Quota that was used to create the rate limiter; if that's not an option for you, I think it might be possible to "decompile" the Gcra elements back into a quota. Is that what you're asking for?

antifuchs avatar Aug 31 '23 00:08 antifuchs

That's a tricky question: To save space, the RateLimiter struct doesn't retain a reference to the Quota (instead, representing the quota in its Gcra elements T and Tau. If you wish to refer back to the Quota, it's probably best to hold on to the Quota that was used to create the rate limiter; if that's not an option for you, I think it might be possible to "decompile" the Gcra elements back into a quota. Is that what you're asking for?

Yes,you are right. I need it.

baoyachi avatar Aug 31 '23 01:08 baoyachi