chore(events,catalog/github): remove old dependecy from limiter
Signed-off-by: Rogerio Angeliski <angeliski@hotmail.com>
This commit is contained in:
@@ -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}`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user