Skip to content

Commit

Permalink
Stop applying concurrency limits. We want to merge the extra tests
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo committed Feb 16, 2023
1 parent 824a395 commit 821f56f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
14 changes: 4 additions & 10 deletions src/plugins/usage_collection/server/collector/collector_set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { withTimeout, asyncMapWithLimit } from '@kbn/std';
import { withTimeout } from '@kbn/std';
import { snakeCase } from 'lodash';

import type {
Expand Down Expand Up @@ -42,21 +42,18 @@ export interface CollectorSetConfig {
export class CollectorSet {
private readonly logger: Logger;
private readonly executionContext: ExecutionContextSetup;
private readonly collectorsFetchConcurrency: number;
private readonly maximumWaitTimeForAllCollectorsInS: number;
private readonly collectors: Map<string, AnyCollector>;
constructor({
logger,
executionContext,
collectorsFetchConcurrency = Infinity,
maximumWaitTimeForAllCollectorsInS = DEFAULT_MAXIMUM_WAIT_TIME_FOR_ALL_COLLECTORS_IN_S,
collectors = [],
}: CollectorSetConfig) {
this.logger = logger;
this.executionContext = executionContext;
this.collectors = new Map(collectors.map((collector) => [collector.type, collector]));
this.maximumWaitTimeForAllCollectorsInS = maximumWaitTimeForAllCollectorsInS;
this.collectorsFetchConcurrency = collectorsFetchConcurrency;
}

/**
Expand Down Expand Up @@ -233,17 +230,15 @@ export class CollectorSet {
// freeze object to prevent collectors from mutating it.
const context = Object.freeze({ esClient, soClient });

const fetchExecutions = await asyncMapWithLimit(
readyCollectors,
this.collectorsFetchConcurrency,
async (collector) => {
const fetchExecutions = await Promise.all(
readyCollectors.map(async (collector) => {
const wrappedPromise = perfTimerify(
`fetch_${collector.type}`,
async () => await this.fetchCollector(collector, context)
);

return await wrappedPromise();
}
})
);
const durationMarks = getMarks();

Expand Down Expand Up @@ -365,7 +360,6 @@ export class CollectorSet {
logger: this.logger,
executionContext: this.executionContext,
maximumWaitTimeForAllCollectorsInS: this.maximumWaitTimeForAllCollectorsInS,
collectorsFetchConcurrency: this.collectorsFetchConcurrency,
collectors,
});
};
Expand Down
1 change: 0 additions & 1 deletion src/plugins/usage_collection/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const configSchema = schema.object({
maximumWaitTimeForAllCollectorsInS: schema.number({
defaultValue: DEFAULT_MAXIMUM_WAIT_TIME_FOR_ALL_COLLECTORS_IN_S,
}),
collectorsFetchConcurrency: schema.number({ defaultValue: 5 }),
});

export type ConfigType = TypeOf<typeof configSchema>;
Expand Down

0 comments on commit 821f56f

Please sign in to comment.