mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-06 13:47:59 +02:00
fix: attempt at avoiding double save
This commit is contained in:
@@ -43,7 +43,7 @@ export default async function (job: SandboxedJob<Repository, void>) {
|
|||||||
} catch (_) {
|
} catch (_) {
|
||||||
// ignore error
|
// ignore error
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 1000);
|
||||||
function updateProgress(obj: { status: string } | string) {
|
function updateProgress(obj: { status: string } | string) {
|
||||||
const o = typeof obj === "string" ? { status: obj } : obj;
|
const o = typeof obj === "string" ? { status: obj } : obj;
|
||||||
progress = o;
|
progress = o;
|
||||||
@@ -65,11 +65,16 @@ export default async function (job: SandboxedJob<Repository, void>) {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error(error);
|
|
||||||
clearInterval(statusInterval);
|
clearInterval(statusInterval);
|
||||||
await repo.updateStatus(RepositoryStatus.ERROR, error.message);
|
|
||||||
span.recordException(error as Exception);
|
span.recordException(error as Exception);
|
||||||
console.log(`[QUEUE] ${job.data.repoId} is finished with an error`);
|
console.log(`[QUEUE] ${job.data.repoId} is finished with an error`, error);
|
||||||
|
setTimeout(async () => {
|
||||||
|
// delay to avoid double saving
|
||||||
|
try {
|
||||||
|
await repo.updateStatus(RepositoryStatus.ERROR, error.message);
|
||||||
|
} catch (ignore) {
|
||||||
|
}
|
||||||
|
}, 400);
|
||||||
} finally {
|
} finally {
|
||||||
clearInterval(statusInterval);
|
clearInterval(statusInterval);
|
||||||
span.end();
|
span.end();
|
||||||
|
|||||||
Reference in New Issue
Block a user