1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-01 19:45:19 +02:00
Maybe/app/services/noop_api_rate_limiter.rb
Juliano Julio Costa 3f92fe0f6f
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions
Relax API rate limits for self-hosted deployments (#2465)
- Introduced NoopApiRateLimiter to effectively disable API rate limiting for self-hosted mode.
- Updated ApiRateLimiter to delegate to NoopApiRateLimiter when running self-hosted.
- Increased Rack::Attack throttle limits significantly for self-hosted deployments.
- Added tests for NoopApiRateLimiter to ensure correct behavior.
- This allows self-hosted users to make more API requests without restriction, while keeping stricter limits for SaaS deployments.
2025-07-23 10:10:11 -04:00

39 lines
525 B
Ruby

class NoopApiRateLimiter
def initialize(api_key)
@api_key = api_key
end
def rate_limit_exceeded?
false
end
def increment_request_count!
# No operation
end
def current_count
0
end
def rate_limit
Float::INFINITY
end
def reset_time
0
end
def usage_info
{
current_count: 0,
rate_limit: Float::INFINITY,
remaining: Float::INFINITY,
reset_time: 0,
tier: :noop
}
end
def self.usage_for(api_key)
new(api_key).usage_info
end
end