Skip to content

Commit

Permalink
Merge pull request #511 from kubeshop/perf/synchronizer-get-suppressi…
Browse files Browse the repository at this point in the history
…ons-query

perf(synchronizer): prevent suppressions api request if access token is empty
  • Loading branch information
monojack authored Sep 13, 2023
2 parents d969c76 + 06d09b8 commit 46be190
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/synchronizer/src/utils/synchronizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,16 @@ export class Synchronizer extends EventEmitter {
};
}

async getSuppressions(rootPath: string, accessToken?: string): Promise<ApiSuppression[]>;
async getSuppressions(repoData: RepoRemoteData, accessToken?: string): Promise<ApiSuppression[]>;
async getSuppressions(projectData: ProjectInputData, accessToken?: string): Promise<ApiSuppression[]>;
async getSuppressions(rootPathOrRepoDataOrProjectData: string | RepoRemoteData | ProjectInputData, accessToken = '') {
async getSuppressions(rootPath: string, accessToken: string): Promise<ApiSuppression[]>;
async getSuppressions(repoData: RepoRemoteData, accessToken: string): Promise<ApiSuppression[]>;
async getSuppressions(projectData: ProjectInputData, accessToken: string): Promise<ApiSuppression[]>;
async getSuppressions(
rootPathOrRepoDataOrProjectData: string | RepoRemoteData | ProjectInputData,
accessToken: string
) {
if (!accessToken || accessToken?.length === 0) {
throw new Error('Cannot fetch without access token.');
}
const inputData = await this.getRepoOrProjectData(rootPathOrRepoDataOrProjectData);
const suppressions = await this.fetchSuppressionsForRepo(inputData as any, accessToken);
return suppressions;
Expand Down

0 comments on commit 46be190

Please sign in to comment.