<commit_before>module Api
  # When RabbitMQ gets a connection, it will check in with the API to make sure
  # the user is allowed to perform the action.
  # Returning "allow" will allow them to perform the requested action.
  # Any other response results in denial.
  # Results are cached for 10 minutes to prevent too many requests to the API.
  class RmqUtilsController < Api::AbstractController
    class BrokerConnectionLimiter
      attr_reader :cache

      CACHE_KEY_TPL = "mqtt_limiter:%s"
      TTL = 60 * 10 # Ten Minutes
      PER_DEVICE_MAX = 10
      MAX_GUEST_COUNT = 256
      WARNING = "'%s' was rate limited."<commit_msg>Lower throttle window from 10 minutes to 5 minutes.<commit_after>module Api
  # When RabbitMQ gets a connection, it will check in with the API to make sure
  # the user is allowed to perform the action.
  # Returning "allow" will allow them to perform the requested action.
  # Any other response results in denial.
  # Results are cached for 10 minutes to prevent too many requests to the API.
  class RmqUtilsController < Api::AbstractController
    class BrokerConnectionLimiter
      attr_reader :cache

      CACHE_KEY_TPL = "mqtt_limiter:%s"
      TTL = 60 * 5 # Ten Minutes
      PER_DEVICE_MAX = 10
      MAX_GUEST_COUNT = 256
      WARNING = "'%s' was rate limited."
{'fraction_non_alphanumeric': 0.055597867479055596, 'fraction_numerical': 0.01827875095201828, 'mean_word_length': 3.2941176470588234, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5552766', 'n_tokens_mistral': 397, 'n_tokens_neox': 362, 'n_words': 163}