Resolved merge conflicts

This commit is contained in:
dominicbachmann
2022-04-05 20:17:53 +02:00
7 changed files with 46 additions and 39 deletions

View File

@@ -65,7 +65,7 @@ export default async function (job: Job<BuilderJob, void, string>): Promise<void
await asyncSleep(500);
await db.prisma.build.updateMany({
where: {
status: 'queued',
status: { in: ['queued', 'running'] },
id: { not: buildId },
applicationId,
createdAt: { lt: new Date(new Date().getTime() - 60 * 60 * 1000) }

View File

@@ -118,10 +118,14 @@ buildWorker.on('completed', async (job: Bullmq.Job) => {
try {
await prisma.build.update({ where: { id: job.data.build_id }, data: { status: 'success' } });
} catch (error) {
setTimeout(async () => {
await prisma.build.update({ where: { id: job.data.build_id }, data: { status: 'success' } });
}, 1234);
console.log(error);
} finally {
const workdir = `/tmp/build-sources/${job.data.repository}/${job.data.build_id}`;
if (!dev) await asyncExecShell(`rm -fr ${workdir}`);
await prisma.build.update({ where: { id: job.data.build_id }, data: { status: 'success' } });
}
return;
});
@@ -130,10 +134,14 @@ buildWorker.on('failed', async (job: Bullmq.Job, failedReason) => {
try {
await prisma.build.update({ where: { id: job.data.build_id }, data: { status: 'failed' } });
} catch (error) {
setTimeout(async () => {
await prisma.build.update({ where: { id: job.data.build_id }, data: { status: 'failed' } });
}, 1234);
console.log(error);
} finally {
const workdir = `/tmp/build-sources/${job.data.repository}`;
if (!dev) await asyncExecShell(`rm -fr ${workdir}`);
await prisma.build.update({ where: { id: job.data.build_id }, data: { status: 'failed' } });
}
await saveBuildLog({
line: 'Failed to deploy!',