mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-23 17:49:40 +02:00
feat: retry 3 times to download a repository
This commit is contained in:
+1
-1
@@ -185,7 +185,7 @@ export default class Repository {
|
|||||||
this._model.anonymizeDate = new Date();
|
this._model.anonymizeDate = new Date();
|
||||||
console.log(`${this._model.repoId} will be updated to ${newCommit}`);
|
console.log(`${this._model.repoId} will be updated to ${newCommit}`);
|
||||||
await this.resetSate("preparing");
|
await this.resetSate("preparing");
|
||||||
await downloadQueue.add(this, { jobId: this.repoId });
|
await downloadQueue.add(this, { jobId: this.repoId, attempts: 3 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -432,7 +432,10 @@ router.post("/", async (req: express.Request, res: express.Response) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.send({ status: repo.status });
|
res.send({ status: repo.status });
|
||||||
downloadQueue.add(new Repository(repo), { jobId: repo.repoId });
|
downloadQueue.add(new Repository(repo), {
|
||||||
|
jobId: repo.repoId,
|
||||||
|
attempts: 3,
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.message?.indexOf(" duplicate key") > -1) {
|
if (error.message?.indexOf(" duplicate key") > -1) {
|
||||||
return handleError(
|
return handleError(
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ router.get(
|
|||||||
// && repo.status != "preparing"
|
// && repo.status != "preparing"
|
||||||
) {
|
) {
|
||||||
await repo.updateStatus("preparing");
|
await repo.updateStatus("preparing");
|
||||||
await downloadQueue.add(repo, { jobId: repo.repoId });
|
await downloadQueue.add(repo, { jobId: repo.repoId, attempts: 3 });
|
||||||
}
|
}
|
||||||
if (repo.status == "error") {
|
if (repo.status == "error") {
|
||||||
throw new AnonymousError(
|
throw new AnonymousError(
|
||||||
|
|||||||
Reference in New Issue
Block a user