From ca591c354655d63e82eef44b591f6e60aea2a0e3 Mon Sep 17 00:00:00 2001 From: hoa3 Date: Tue, 20 Aug 2024 11:57:06 +0200 Subject: [PATCH] fix: add more useful logging when github crawler ratelimit is reached --- .../github-crawler/github-crawler.service.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/oss-api/src/github-crawler/github-crawler.service.ts b/oss-api/src/github-crawler/github-crawler.service.ts index 095c8a4..677cab4 100644 --- a/oss-api/src/github-crawler/github-crawler.service.ts +++ b/oss-api/src/github-crawler/github-crawler.service.ts @@ -340,6 +340,9 @@ export class GithubCrawlerService { parseInt(error.response.headers['x-ratelimit-limit']) ) { this.reachedGithubCallLimit = true; + console.log( + 'Ratelimit is reached. ause Crawling until Github-Api allows new calls (at xx.00)', + ); } this.logger.error(error); this.telemetryService.incrementErrorStatus(); @@ -394,6 +397,9 @@ export class GithubCrawlerService { parseInt(error.response.headers['x-ratelimit-limit']) ) { this.reachedGithubCallLimit = true; + console.log( + 'Ratelimit is reached. ause Crawling until Github-Api allows new calls (at xx.00)', + ); } this.logger.error(error); this.telemetryService.incrementErrorStatus(); @@ -454,6 +460,9 @@ export class GithubCrawlerService { parseInt(error.response.headers['x-ratelimit-limit']) ) { this.reachedGithubCallLimit = true; + console.log( + 'Ratelimit is reached. ause Crawling until Github-Api allows new calls (at xx.00)', + ); return; } this.logger.error(error); @@ -518,6 +527,9 @@ export class GithubCrawlerService { parseInt(error.response.headers['x-ratelimit-limit']) ) { this.reachedGithubCallLimit = true; + console.log( + 'Ratelimit is reached. ause Crawling until Github-Api allows new calls (at xx.00)', + ); } this.logger.error(error); this.telemetryService.incrementErrorStatus(); @@ -581,6 +593,9 @@ export class GithubCrawlerService { parseInt(error.response.headers['x-ratelimit-limit']) ) { this.reachedGithubCallLimit = true; + console.log( + 'Ratelimit is reached. ause Crawling until Github-Api allows new calls (at xx.00)', + ); } this.logger.error(error); this.telemetryService.incrementErrorStatus(); @@ -646,6 +661,9 @@ export class GithubCrawlerService { parseInt(error.response.headers['x-ratelimit-limit']) ) { this.reachedGithubCallLimit = true; + console.log( + 'Ratelimit is reached. ause Crawling until Github-Api allows new calls (at xx.00)', + ); } this.logger.error(error); this.telemetryService.incrementErrorStatus(); @@ -709,6 +727,9 @@ export class GithubCrawlerService { parseInt(error.response.headers['x-ratelimit-limit']) ) { this.reachedGithubCallLimit = true; + console.log( + 'Ratelimit is reached. ause Crawling until Github-Api allows new calls (at xx.00)', + ); } this.logger.error(error); this.telemetryService.incrementErrorStatus(); @@ -768,6 +789,9 @@ export class GithubCrawlerService { parseInt(error.response.headers['x-ratelimit-limit']) ) { this.reachedGithubCallLimit = true; + console.log( + 'Ratelimit is reached. ause Crawling until Github-Api allows new calls (at xx.00)', + ); } this.logger.error(error); this.telemetryService.incrementErrorStatus(); @@ -835,6 +859,9 @@ export class GithubCrawlerService { parseInt(error.response.headers['x-ratelimit-limit']) ) { this.reachedGithubCallLimit = true; + console.log( + 'Ratelimit is reached. ause Crawling until Github-Api allows new calls (at xx.00)', + ); } this.logger.error(error); this.telemetryService.incrementErrorStatus(); @@ -885,6 +912,9 @@ export class GithubCrawlerService { parseInt(error.response.headers['x-ratelimit-limit']) ) { this.reachedGithubCallLimit = true; + console.log( + 'Ratelimit is reached. ause Crawling until Github-Api allows new calls (at xx.00)', + ); } this.logger.error(error); this.telemetryService.incrementErrorStatus(); @@ -939,6 +969,9 @@ export class GithubCrawlerService { parseInt(error.response.headers['x-ratelimit-limit']) ) { this.reachedGithubCallLimit = true; + console.log( + 'Ratelimit is reached. ause Crawling until Github-Api allows new calls (at xx.00)', + ); } this.logger.error(error); this.telemetryService.incrementErrorStatus(); @@ -1000,6 +1033,9 @@ export class GithubCrawlerService { parseInt(error.response.headers['x-ratelimit-limit']) ) { this.reachedGithubCallLimit = true; + console.log( + 'Ratelimit is reached. ause Crawling until Github-Api allows new calls (at xx.00)', + ); } this.logger.error(error); this.telemetryService.incrementErrorStatus();