mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-10-01 22:29:47 +02:00
fix: serialize repository refreshes and recover stale downloads
This commit is contained in:
1 parent
3c41a00137
commit
0002e8d1a1
4 files changed
+232
-13
No files matched your search
@@ -132,14 +132,15 @@ router.post(
|
||||
if (
|
||||
repo.status == RepositoryStatus.PREPARING ||
|
||||
repo.status == RepositoryStatus.QUEUE ||
|
||||
repo.status == RepositoryStatus.DOWNLOAD ||
|
||||
(repo.status == RepositoryStatus.DOWNLOAD &&
|
||||
repo.model.statusDate > new Date(Date.now() - 5 * 60_000)) ||
|
||||
repo.status == RepositoryStatus.REMOVING ||
|
||||
repo.status == RepositoryStatus.EXPIRING
|
||||
) {
|
||||
throw new AnonymousError("invalid_status", { httpStatus: 409 });
|
||||
}
|
||||
|
||||
await repo.updateIfNeeded({ force: true });
|
||||
await repo.refresh();
|
||||
res.json({ status: repo.status });
|
||||
} catch (error) {
|
||||
handleError(error, res, req);
|
||||
|
||||
Reference in new issue
Block a user