question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generalization of `.getNanosToWaitForReset()`

See original GitHub issue

Hi, really good library, thanks a lot for your work!

I had to use the 7.0.0-beta-2020-04-18 release only because the ConsumptionProbe has this method. I am using Caffeine as a local cache for buckets and need this information to compute accurate TTLs on buckets every time tokens are consumed. By getting this full refill interval, a bucket can be safely marked as stale after this point in time: we know it will be full, so there is no point keeping it in memory.

Some questions / comments:

  1. There isn’t any other way getting this information in the stable release, is there? Using the beta is mandatory?
  2. I need to apply the same logic when adding tokens manually but it is a bit absurd: refill what is needed + force refill 1 token + consume 1 token to get the ConsumptionProbe ; It would be useful obtaining this information (.getNantosToWaitForReset()) outside of consumption probes.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
vladimir-bukhtoyarovcommented, Nov 14, 2021

With version 6.4.0 desired behavior can be achieved in the following way:

VerboseResult<Nothing> result = bucket.asVerbose().addTokens(1);
long waitForRefillNanos = result.getDiagnostics().calculateFullRefillingTime();
0reactions
helinscommented, Nov 20, 2021

Thanks for your prompt action, works perfectly and does the job 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generalization of .getNanosToWaitForReset() #187 - GitHub
I am using Caffeine as a local cache for buckets and need this information to compute accurate TTLs on buckets every time tokens...
Read more >
Generalization - OASIS Open
Specialized content can be generalized to any ancestor type. The generalization process can preserve information about the former level of specialization to ...
Read more >
Incorrect buffersize description in the CRYPTO_128_unwrap ...
There is an issue with the CRYPTO_128_unwrap() and internally on the ... Generalization of `.getNanosToWaitForReset()`, 7, 2021-11-09, 2022-08-10.
Read more >
Same transports are created two times - Ipfs/Go-Ipfs - IssueHint
Coherence 12.2.1.4.7 with Bucket4j 6.2.0 fails with java.io.IOException: Unknown type id 768, 7, 2021-09-24 ; Generalization of `.getNanosToWaitForReset()`, 7 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found