nomagick commited on
Commit
e2698b4
·
unverified ·
1 Parent(s): 72e1c46

fix: rate limit tag for search

Browse files
backend/functions/src/cloud-functions/searcher.ts CHANGED
@@ -156,7 +156,7 @@ export class SearcherHost extends RPCHost {
156
  throw new InsufficientBalanceError(`Account balance not enough to run this query, please recharge.`);
157
  }
158
 
159
- const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(rpcReflect, uid, ['CRAWL'],
160
  [
161
  // 40 requests per minute
162
  new Date(Date.now() - 60 * 1000), 40
@@ -175,7 +175,7 @@ export class SearcherHost extends RPCHost {
175
  });
176
  } else if (ctx.req.ip) {
177
  this.threadLocal.set('ip', ctx.req.ip);
178
- const apiRoll = await this.rateLimitControl.simpleRpcIPBasedLimit(rpcReflect, ctx.req.ip, ['CRAWL'],
179
  [
180
  // 5 requests per minute
181
  new Date(Date.now() - 60 * 1000), 5
 
156
  throw new InsufficientBalanceError(`Account balance not enough to run this query, please recharge.`);
157
  }
158
 
159
+ const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(rpcReflect, uid, ['SEARCH'],
160
  [
161
  // 40 requests per minute
162
  new Date(Date.now() - 60 * 1000), 40
 
175
  });
176
  } else if (ctx.req.ip) {
177
  this.threadLocal.set('ip', ctx.req.ip);
178
+ const apiRoll = await this.rateLimitControl.simpleRpcIPBasedLimit(rpcReflect, ctx.req.ip, ['SEARCH'],
179
  [
180
  // 5 requests per minute
181
  new Date(Date.now() - 60 * 1000), 5