chore(events,catalog/github): remove old dependecy from limiter

Signed-off-by: Rogerio Angeliski <angeliski@hotmail.com>
This commit is contained in:
Rogerio Angeliski
2022-11-25 00:57:57 +00:00
parent f96bd38dc0
commit 38709640f5
3 changed files with 9 additions and 27 deletions
@@ -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"
},
@@ -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<void>[] = [];
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}`,
);
-1
View File
@@ -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