allowRequest method

bool allowRequest(
  1. String requestId
)

Implementation

bool allowRequest(String requestId) {
  final now = DateTime.now();

  ///Clean up old requests
  _removeOldRequests(requestId, now);

  /// check if id has exceeded max-requests
  if ((_requestsLog[requestId]?.length ?? 0) >= maxRequests) {
    ///limit reached
    return false;
  }

  ///Register this request
  _logRequest(requestId, now);

  /// allow this request
  return true;
}