mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-09-15 15:15:29 +02:00
improve queue
This commit is contained in:
@@ -339,8 +339,8 @@ router.get(
|
||||
fiveMinuteAgo.setMinutes(fiveMinuteAgo.getMinutes() - 5);
|
||||
if (repo.status != "ready") {
|
||||
if (
|
||||
repo.status != RepositoryStatus.QUEUE &&
|
||||
repo.model.statusDate < fiveMinuteAgo
|
||||
// && repo.status != "preparing"
|
||||
) {
|
||||
await repo.updateStatus(RepositoryStatus.PREPARING);
|
||||
await downloadQueue.add(repo.repoId, { repoId: repo.repoId }, {
|
||||
@@ -359,6 +359,14 @@ router.get(
|
||||
}
|
||||
);
|
||||
}
|
||||
const rlMatch = (repo.model.statusMessage || "").match(/^rate_limited:(\d+)$/);
|
||||
if (rlMatch) {
|
||||
const resetAt = parseInt(rlMatch[1], 10);
|
||||
throw new AnonymousError("rate_limited", {
|
||||
httpStatus: 425,
|
||||
object: { resetAt },
|
||||
});
|
||||
}
|
||||
throw new AnonymousError("repository_not_ready", {
|
||||
httpStatus: 425,
|
||||
object: repo,
|
||||
|
||||
Reference in New Issue
Block a user