Merge pull request #1149 from github/aeisenberg/avoid-redownload

Avoid re-downloading analyses
This commit is contained in:
Andrew Eisenberg 2022-02-17 08:14:58 -08:00 коммит произвёл GitHub
Родитель 2110709d72 85e3869607
Коммит 84b4bfe663
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -24,7 +24,7 @@ export class AnalysesResultsManager {
analysisSummary: AnalysisSummary,
publishResults: (analysesResults: AnalysisResults[]) => Promise<void>
): Promise<void> {
if (this.analysesResults.some(x => x.nwo === analysisSummary.nwo)) {
if (this.isAnalysisDownloaded(analysisSummary)) {
// We already have the results for this analysis, don't download again.
return;
}
@ -37,10 +37,13 @@ export class AnalysesResultsManager {
}
public async downloadAnalysesResults(
analysesToDownload: AnalysisSummary[],
allAnalysesToDownload: AnalysisSummary[],
token: CancellationToken | undefined,
publishResults: (analysesResults: AnalysisResults[]) => Promise<void>
): Promise<void> {
// Filter out analyses that we have already downloaded.
const analysesToDownload = allAnalysesToDownload.filter(x => !this.isAnalysisDownloaded(x));
const credentials = await Credentials.initialize(this.ctx);
void this.logger.log('Downloading and processing analyses results');
@ -133,4 +136,8 @@ export class AnalysesResultsManager {
return queryResults;
}
private isAnalysisDownloaded(analysis: AnalysisSummary): boolean {
return this.analysesResults.some(x => x.nwo === analysis.nwo);
}
}