Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fetch breaking operations and clients in parallel to improve lat… #6431

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -496,31 +496,26 @@ export class RegistryChecks {
// Since the affected clients query is lighter it makes more sense to run it first and skip running
// the operations query if no clients are affected, as it will also yield zero results in that case.

const topAffectedClients = await this.operationsReader.getTopClientsForSchemaCoordinate(
{
const [topAffectedClients, topAffectedOperations] = await Promise.all([
this.operationsReader.getTopClientsForSchemaCoordinate(
{
targetIds: settings.targetIds,
excludedClients: settings.excludedClientNames,
period: settings.period,
schemaCoordinate: change.breakingChangeSchemaCoordinate,
},
), this.operationsReader.getTopOperationsForSchemaCoordinate({
targetIds: settings.targetIds,
excludedClients: settings.excludedClientNames,
period: settings.period,
schemaCoordinate: change.breakingChangeSchemaCoordinate,
},
);
}),
]);

if (topAffectedClients) {
const topAffectedOperations =
await this.operationsReader.getTopOperationsForSchemaCoordinate({
targetIds: settings.targetIds,
excludedClients: settings.excludedClientNames,
period: settings.period,
schemaCoordinate: change.breakingChangeSchemaCoordinate,
});

if (topAffectedOperations) {
change.usageStatistics = {
topAffectedOperations,
topAffectedClients,
};
}
}
change.usageStatistics = {
topAffectedOperations: topAffectedOperations ?? [],
topAffectedClients: topAffectedClients ?? [],
};
}

change.isSafeBasedOnUsage = !isBreaking;
Expand Down
Loading