From 280c8a80724b40d5fd2140691a89a55d47c6d718 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Tue, 10 Dec 2019 06:54:24 -0800 Subject: [PATCH] fix(rate limit): Fixed free 10 RPM tier --- src/middleware/route-ratelimit.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/middleware/route-ratelimit.js b/src/middleware/route-ratelimit.js index b67c045..8d92413 100644 --- a/src/middleware/route-ratelimit.js +++ b/src/middleware/route-ratelimit.js @@ -6,8 +6,8 @@ Current rate limiting rules in requests-per-minute: - anonymous access: 3 - - free access: 10 - - any paid tier: 100 + - free access: 10, apiLevel = 0 + - any paid tier: 100, apiLevel > 0 */ "use strict" @@ -103,9 +103,9 @@ const routeRateLimit = async function(req, res, next) { const proRateLimits = req.locals.proLimit // Pro level rate limits - if (proRateLimits) { + if (proRateLimits !== undefined) { // TODO: replace the console.logs with calls to our logging system. - //console.log(`applying pro-rate limits`) + console.log(`applying pro-rate limits`) let PRO_RPM = 10 // Default value for free tier if (req.locals.apiLevel > 0) PRO_RPM = 100 // RPM for paid tiers. @@ -130,7 +130,7 @@ const routeRateLimit = async function(req, res, next) { // Freemium level rate limits } else { // TODO: replace the console.logs with calls to our logging system. - //console.log(`applying freemium limits`) + console.log(`applying freemium limits`) // Create new RateLimit if none exists for this route if (!uniqueRateLimits[route]) {