fix: fix GitHubDownload

This commit is contained in:
tdurieux
2024-04-03 13:24:34 +01:00
parent fc469be61b
commit db67f53b2c
7 changed files with 112 additions and 57 deletions

View File

@@ -19,6 +19,7 @@ import AnonymizedRepositoryModel from "./model/anonymizedRepositories/anonymized
import { GitHubRepository } from "./source/GitHubRepository";
import { trace } from "@opentelemetry/api";
import { getToken } from "./GitHubUtils";
import { FILE_TYPE } from "./storage/Storage";
function anonymizeTreeRecursive(
tree: TreeElement,
@@ -219,6 +220,23 @@ export default class Repository {
});
}
async isReady() {
if (this.status !== RepositoryStatus.READY) return false;
if (
this.source.type == "GitHubDownload" &&
(await storage.exists(this.repoId)) == FILE_TYPE.NOT_FOUND
) {
await this.resetSate(RepositoryStatus.PREPARING);
await downloadQueue.add(this.repoId, this, {
jobId: this.repoId,
attempts: 3,
});
return false;
}
return true;
}
/**
* Update the repository if a new commit exists
*