Add flag to persist builds
Some checks failed
App Image CI / Build app image (push) Successful in -1m2s
NPM Audit Check / Check NPM audit (push) Failing after -2m7s
Docker Image CI / Build build images (arch) (push) Successful in 47s
Docker Image CI / Build build images (artix) (push) Successful in -27s

This commit is contained in:
2025-11-26 18:20:44 -05:00
parent 7bd8bf4d85
commit d803a58ab8
9 changed files with 104 additions and 61 deletions

View File

@@ -30,6 +30,7 @@ interface Build {
pid?: number;
sqid?: string;
uuid: string;
persist: boolean;
}
interface User {
@@ -128,6 +129,10 @@ class DB extends Store {
uuid: {
type: DataTypes.STRING,
unique: true
},
persist: {
type: DataTypes.BOOLEAN,
defaultValue: false
}
});
@@ -262,6 +267,16 @@ class DB extends Store {
});
}
public async persist(id: number, persist: boolean = true): Promise<void> {
await this.build.update({
persist
}, {
where: {
id
}
});
}
public async appendLog(buildId: number, type: LogType, chunk: string): Promise<void> {
await this.logChunk.create({
buildId,
@@ -366,7 +381,8 @@ class DB extends Store {
public async cleanup(): Promise<void> {
await this.build.destroy({
where: {
startTime: { [Op.lt]: new Date(Date.now() - MONTH * 6) }
startTime: { [Op.lt]: new Date(Date.now() - MONTH * 6) },
persist: { [Op.eq]: false }
},
force: true
});