Class ReadinessRateLimiter

java.lang.Object
io.jans.fido2.service.readiness.ReadinessRateLimiter

@ApplicationScoped public class ReadinessRateLimiter extends Object
Bounds how much outbound work the readiness endpoint can cause, per node. Three limits, all constants: In a cluster each node applies its own limits, so the installation-wide ceiling is the number of nodes times these values. A refused request is never turned into a fetch: the caller answers 429 with Retry-After.
  • Field Details

  • Constructor Details

    • ReadinessRateLimiter

      public ReadinessRateLimiter()
  • Method Details

    • tryAcquire

      public long tryAcquire(String rpId, int fetches)
      Asks to run a check that fetches fetches files for rpId.
      Returns:
      0 when granted (the caller must then call release()), otherwise the number of milliseconds to wait before asking again
    • release

      public void release()
    • nextAllowedAt

      public long nextAllowedAt(String rpId)
      Earliest time, in epoch milliseconds, at which rpId may be fetched again.