Method: Datadog::Core::TokenBucket#allow?

Defined in:
lib/datadog/core/rate_limiter.rb

#allow?(size = 1) ⇒ Boolean

Checks if a message of provided size conforms with the current bucket limit.

If it does, return true and remove size tokens from the bucket. If it does not, return false without affecting the tokens from the bucket.

Returns:

  • (Boolean)

    true if message conforms with current bucket limit


64
65
66
67
68
# File 'lib/datadog/core/rate_limiter.rb', line 64

def allow?(size = 1)
  allowed = should_allow?(size)
  update_rate_counts(allowed)
  allowed
end