chore: improve job status reporting

This commit is contained in:
tdurieux
2023-07-05 13:43:57 +02:00
parent 68d96ad82e
commit 9fea119f50

View File

@@ -19,11 +19,13 @@ export default async function (job: SandboxedJob<Repository, void>) {
const repo = await getRepository(job.data.repoId);
job.updateProgress({ status: "get_repo" });
try {
await repo.resetSate(RepositoryStatus.PREPARING, "");
job.updateProgress({ status: "resetSate" });
await repo.resetSate(RepositoryStatus.PREPARING, "");
job.updateProgress({ status: "download" });
await repo.anonymize();
console.log(`[QUEUE] ${job.data.repoId} is downloaded`);
} catch (error) {
job.updateProgress({ status: "error" });
if (error instanceof Error) {
await repo.updateStatus(RepositoryStatus.ERROR, error.message);
} else if (typeof error === "string") {