From 38709640f58acd3b01326101d1fce00b2a070190 Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Fri, 25 Nov 2022 00:57:57 +0000 Subject: [PATCH] chore(events,catalog/github): remove old dependecy from limiter Signed-off-by: Rogerio Angeliski --- .../package.json | 1 - .../src/providers/GithubEntityProvider.ts | 34 +++++-------------- yarn.lock | 1 - 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/plugins/catalog-backend-module-github/package.json b/plugins/catalog-backend-module-github/package.json index 4676e847d7..2e6892ab2b 100644 --- a/plugins/catalog-backend-module-github/package.json +++ b/plugins/catalog-backend-module-github/package.json @@ -51,7 +51,6 @@ "git-url-parse": "^13.0.0", "lodash": "^4.17.21", "node-fetch": "^2.6.7", - "p-limit": "^3.0.2", "uuid": "^8.0.0", "winston": "^3.2.1" }, diff --git a/plugins/catalog-backend-module-github/src/providers/GithubEntityProvider.ts b/plugins/catalog-backend-module-github/src/providers/GithubEntityProvider.ts index 4aaba06e3e..8e9001f4cd 100644 --- a/plugins/catalog-backend-module-github/src/providers/GithubEntityProvider.ts +++ b/plugins/catalog-backend-module-github/src/providers/GithubEntityProvider.ts @@ -34,7 +34,6 @@ import { LocationSpec } from '@backstage/plugin-catalog-common'; import { graphql } from '@octokit/graphql'; import * as uuid from 'uuid'; -import limiterFactory from 'p-limit'; import { Logger } from 'winston'; import { readProviderConfigs, @@ -335,37 +334,22 @@ export class GithubEntityProvider implements EntityProvider, EventSubscriber { (commit: Commit) => [...commit.modified], ); - const limiter = limiterFactory(10); - const promises: Promise[] = []; - if (modified.length > 0) { - const connection = this.connection; - promises.push( - limiter(async () => - connection.refresh({ - keys: modified.map( - filePath => - `url:${event.repository.url}/tree/${branch}/${filePath}`, - ), - }), + await this.connection.refresh({ + keys: modified.map( + filePath => `url:${event.repository.url}/tree/${branch}/${filePath}`, ), - ); + }); } if (added.length > 0 || removed.length > 0) { - const connection = this.connection; - promises.push( - limiter(async () => - connection.applyMutation({ - type: 'delta', - added: added, - removed: removed, - }), - ), - ); + await this.connection.applyMutation({ + type: 'delta', + added: added, + removed: removed, + }); } - await Promise.all(promises); this.logger.info( `Processed Github push event: added ${added.length} - removed ${removed.length} - modified ${modified.length}`, ); diff --git a/yarn.lock b/yarn.lock index 1bb601d415..d0a9b4942a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4589,7 +4589,6 @@ __metadata: luxon: ^3.0.0 msw: ^0.49.0 node-fetch: ^2.6.7 - p-limit: ^3.0.2 uuid: ^8.0.0 winston: ^3.2.1 languageName: unknown