Commit b2b1b2fb authored by nanahira's avatar nanahira

chunking archive save

parent 621974e9
Pipeline #12483 passed with stages
in 5 minutes and 45 seconds
......@@ -207,10 +207,9 @@ export class AppService extends ConsoleLogger {
const result = await this.packager.build(stream, app.packagePrefix, previousTracingBuildChecksums);
this.log(`Saving package info of ${app.id} ${version} for ${JSON.stringify(depot)}`);
build.checksum = result.checksum;
build.archives = result.archives;
build = await this.db.getRepository(Build).save(build);
this.mirror.triggerMirror();
/*
//build.archives = result.archives;
//build = await this.db.getRepository(Build).save(build);
await this.db.transaction(async (edb) => {
this.log(`Saving build info.`);
build = await edb.getRepository(Build).save(build);
......@@ -218,7 +217,7 @@ export class AppService extends ConsoleLogger {
let currentSize = 0;
for (const archive of result.archives) {
archive.build = build;
const size = archive.paramSize;
const size = archive.getParamSize();
if (currentSize > 0 && currentSize + size > 60000) {
this.log(`Saving ${archivePot.length} archive infos.`);
await edb.getRepository(Archive).save(archivePot);
......@@ -233,7 +232,8 @@ export class AppService extends ConsoleLogger {
await edb.getRepository(Archive).save(archivePot);
}
});
*/
this.mirror.triggerMirror();
this.log(`Finished packaging ${app.id} ${version} for ${JSON.stringify(depot)}`);
return new BlankReturnMessageDto(201, 'success');
} catch (e) {
......@@ -353,9 +353,7 @@ export class AppService extends ConsoleLogger {
async checkHashFromUrl(url: string) {
this.log(`Downloading ${url} for checking hash.`);
const { data } = await lastValueFrom(
this.http.get<internal.Readable>(url, { responseType: 'stream' })
);
const { data } = await lastValueFrom(this.http.get<internal.Readable>(url, { responseType: 'stream' }));
return new Promise<string>((resolve, reject) => {
const hashObject = createHash('sha256');
data.on('data', (data) => hashObject.update(data));
......
......@@ -44,9 +44,9 @@ export class Archive extends TimeBase {
return `${this.path}.tar.zst`;
}
//get paramSize() {
// return 5 + (this.containingFiles ? this.containingFiles.length * 2 : 0);
//}
getParamSize() {
return 5 + (this.files?.length || 0);
}
toMetalinkView() {
return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment