Spaces:
Build error
Build error
fix: try to partition apiroll query
Browse files- src/api/crawler.ts +3 -3
- thinapps-shared +1 -1
src/api/crawler.ts
CHANGED
|
@@ -258,7 +258,7 @@ export class CrawlerHost extends RPCHost {
|
|
| 258 |
throw new InsufficientBalanceError(`Account balance not enough to run this query, please recharge.`);
|
| 259 |
}
|
| 260 |
|
| 261 |
-
const rateLimitPolicy = auth.getRateLimits(
|
| 262 |
parseInt(user.metadata?.speed_level) >= 2 ?
|
| 263 |
RateLimitDesc.from({
|
| 264 |
occurrence: 2000,
|
|
@@ -271,7 +271,7 @@ export class CrawlerHost extends RPCHost {
|
|
| 271 |
];
|
| 272 |
|
| 273 |
const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(
|
| 274 |
-
rpcReflect, uid, [
|
| 275 |
...rateLimitPolicy
|
| 276 |
);
|
| 277 |
|
|
@@ -287,7 +287,7 @@ export class CrawlerHost extends RPCHost {
|
|
| 287 |
}
|
| 288 |
});
|
| 289 |
} else if (ctx.ip) {
|
| 290 |
-
const apiRoll = await this.rateLimitControl.simpleRpcIPBasedLimit(rpcReflect, ctx.ip, [
|
| 291 |
[
|
| 292 |
// 20 requests per minute
|
| 293 |
new Date(Date.now() - 60 * 1000), 20
|
|
|
|
| 258 |
throw new InsufficientBalanceError(`Account balance not enough to run this query, please recharge.`);
|
| 259 |
}
|
| 260 |
|
| 261 |
+
const rateLimitPolicy = auth.getRateLimits('CRAWL') || [
|
| 262 |
parseInt(user.metadata?.speed_level) >= 2 ?
|
| 263 |
RateLimitDesc.from({
|
| 264 |
occurrence: 2000,
|
|
|
|
| 271 |
];
|
| 272 |
|
| 273 |
const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(
|
| 274 |
+
rpcReflect, uid, ['CRAWL'],
|
| 275 |
...rateLimitPolicy
|
| 276 |
);
|
| 277 |
|
|
|
|
| 287 |
}
|
| 288 |
});
|
| 289 |
} else if (ctx.ip) {
|
| 290 |
+
const apiRoll = await this.rateLimitControl.simpleRpcIPBasedLimit(rpcReflect, ctx.ip, ['CRAWL'],
|
| 291 |
[
|
| 292 |
// 20 requests per minute
|
| 293 |
new Date(Date.now() - 60 * 1000), 20
|
thinapps-shared
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
Subproject commit
|
|
|
|
| 1 |
+
Subproject commit 9a04a66d10635bd4e5f46123fc2b59ec802bf3b7
|