fix: fallback to db logs
This commit is contained in:
parent
69891a64a0
commit
31d9740aac
@ -1195,8 +1195,17 @@ export async function getBuildIdLogs(request: FastifyRequest<GetBuildIdLogs>) {
|
|||||||
try {
|
try {
|
||||||
await fs.stat(file)
|
await fs.stat(file)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
let logs = await prisma.buildLog.findMany({
|
||||||
|
where: { buildId, time: { gt: sequence } },
|
||||||
|
orderBy: { time: 'asc' }
|
||||||
|
});
|
||||||
|
const data = await prisma.build.findFirst({ where: { id: buildId } });
|
||||||
|
const createdAt = day(data.createdAt).utc();
|
||||||
return {
|
return {
|
||||||
logs: [],
|
logs: logs.map(log => {
|
||||||
|
log.time = Number(log.time)
|
||||||
|
return log
|
||||||
|
}),
|
||||||
took: day().diff(createdAt) / 1000,
|
took: day().diff(createdAt) / 1000,
|
||||||
status: data?.status || 'queued'
|
status: data?.status || 'queued'
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user