Commit 876560a3 authored by nanahira's avatar nanahira

use existing archive only when archive record exists

parent 3b7d72ed
Pipeline #4985 passed with stages
in 2 minutes and 48 seconds
...@@ -181,9 +181,10 @@ export class PackagerService extends ConsoleLogger { ...@@ -181,9 +181,10 @@ export class PackagerService extends ConsoleLogger {
const archiveName = archiveTask.archiveFullPath; const archiveName = archiveTask.archiveFullPath;
const existing = await this.s3.fileExists(archiveName); const existing = await this.s3.fileExists(archiveName);
if (existing) { if (existing) {
archive.size = existing.Size;
const hash = await this.appService.lookForExistingArchiveHash(archiveTask.path); const hash = await this.appService.lookForExistingArchiveHash(archiveTask.path);
if (hash) { if (hash) {
this.log(`Archive ${archiveName} exists, skipping.`);
archive.size = existing.Size;
archive.hash = hash; archive.hash = hash;
return archive; return archive;
} }
...@@ -209,11 +210,11 @@ export class PackagerService extends ConsoleLogger { ...@@ -209,11 +210,11 @@ export class PackagerService extends ConsoleLogger {
child.stdout.on('data', (chunk) => { child.stdout.on('data', (chunk) => {
hashObject.update(chunk); hashObject.update(chunk);
}); });
if (existing) { /* if (existing) {
await childPromise; await childPromise;
archive.hash = hashObject.digest('hex'); archive.hash = hashObject.digest('hex');
return archive; return archive;
} }*/
const uploadPromise = this.s3.uploadStream(archiveName, child.stdout, { const uploadPromise = this.s3.uploadStream(archiveName, child.stdout, {
ContentType: 'application/tar+zstd', ContentType: 'application/tar+zstd',
}); });
......
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