You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// return a throttled middleware. Check every 100ms? make this a setting?
70
104
// how do we make sure these get queued properly?
71
105
// store the requests in an array when available grab the next request for a user
@@ -81,7 +115,6 @@ export function expressRateLimiter(
81
115
* Not throttling on time just queueing requests.
82
116
*/
83
117
84
-
// return the rate limiting middleware
85
118
returnasync(
86
119
req: Request,
87
120
res: Response,
@@ -95,7 +128,7 @@ export function expressRateLimiter(
95
128
returnnext();
96
129
}
97
130
/**
98
-
* There are numorous ways to get the ip address off of the request object.
131
+
* There are numerous ways to get the ip address off of the request object.
99
132
* - the header 'x-forward-for' will hold the originating ip address if a proxy is placed infront of the server. This would be commen for a production build.
100
133
* - req.ips wwill hold an array of ip addresses in'x-forward-for' header. client is likely at index zero
101
134
* - req.ip will have the ip address
@@ -105,7 +138,6 @@ export function expressRateLimiter(
105
138
*/
106
139
// check for a proxied ip address before using the ip address on request
107
140
constip: string=req.ips ? req.ips[0] : req.ip;
108
-
// requestsInProcess[ip] = true;
109
141
110
142
// FIXME: this will only work with type complexity
111
143
constqueryAST=parse(query);
@@ -121,7 +153,7 @@ export function expressRateLimiter(
121
153
try{
122
154
// process the request and conditinoally respond to client with status code 429 or
123
155
// pass the request onto the next middleware function
0 commit comments