| 456 | } |
| 457 | |
| 458 | private getMaxRuns(scraper: any): any{ |
| 459 | if (this.isScraperBasedRateLimit) { |
| 460 | // For scraper-based rate limit, use the scraper name as key. |
| 461 | // @ts-ignore |
| 462 | return this.rateLimit[scraper.scraper_name] ?? null; |
| 463 | } else { |
| 464 | // For type-based rate limit, use the scraper type as key. |
| 465 | // @ts-ignore |
| 466 | return this.rateLimit[scraper.scraper_type] ?? null; |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | setRateLimit(rateLimit: { browser?: number; request?: number; task?: number } | Record<string, number> = { browser: 1 }): void { |
| 471 | const allowedKeys = ['browser', 'request', 'task']; |