Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: Try to update build status several times

Andras Bacsai7ab5a4bfcf42
diff --git a/src/lib/queues/index.ts b/src/lib/queues/index.ts
index 58b9e583d8..6c1cc29c24 100644
--- a/src/lib/queues/index.ts
+++ b/src/lib/queues/index.ts
@@ -116,7 +116,22 @@ const buildWorker = new Worker(buildQueueName, async (job) => await builder(job)
buildWorker.on('completed', async (job: Bullmq.Job) => {
try {
- await prisma.build.update({ where: { id: job.data.build_id }, data: { status: 'success' } });
+ await asyncUntil(
+ async () => {
+ const found = await prisma.build.findFirst({
+ where: { id: job.data.build_id, status: 'success' }
+ });
+ if (!found) {
+ return await prisma.build.update({
+ where: { id: job.data.build_id },
+ data: { status: 'success' }
+ });
+ }
+ return true;
+ },
+ 100,
+ 5
+ );
} catch (error) {
console.log(error);
} finally {
@@ -141,7 +156,7 @@ buildWorker.on('failed', async (job: Bullmq.Job, failedReason) => {
}
return true;
},
- 200,
+ 100,
5
);
} catch (error) {