From ea37b1fa9132be10e0a26da0acfc2c1bbd6ef93e Mon Sep 17 00:00:00 2001 From: Nathaniel Rindlaub Date: Fri, 8 Sep 2023 22:04:00 -0700 Subject: [PATCH] Stop copying images to archive bucket, #66 --- ingest-image/task.js | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/ingest-image/task.js b/ingest-image/task.js index fd96a57..c909a67 100644 --- a/ingest-image/task.js +++ b/ingest-image/task.js @@ -45,7 +45,6 @@ export default class Task { this.SSM.set(`/api/exif-function-${this.STAGE}`, 'EXIF_FUNCTION'); this.SSM.set(`/images/batch-queue-${this.STAGE}`, 'BATCH_QUEUE'); this.SSM.set(`/images/batch-job-${this.STAGE}`, 'BATCH_JOB'); - this.SSM.set(`/images/archive-bucket-${this.STAGE}`, 'ARCHIVE_BUCKET'); this.SSM.set(`/images/serving-bucket-${this.STAGE}`, 'SERVING_BUCKET'); this.SSM.set(`/images/dead-letter-bucket-${this.STAGE}`, 'DEADLETTER_BUCKET'); for (const ssm of this.SSM.values()) this[ssm] = null; @@ -169,7 +168,6 @@ export default class Task { await this.copy_to_dlb(err, md); } else { await this.copy_to_prod(md); - await this.copy_to_archive(md); } } catch (err) { @@ -225,24 +223,6 @@ export default class Task { })); } - async copy_to_archive(md) { - const Bucket = md['ArchiveBucket']; - const parse = path.parse(md.FileName); - const archive_filename = parse.name + '_' + md['_id'] + parse.ext; - const Key = path.join(String(md['SerialNumber']), archive_filename); - - console.log(`Transferring s3://${Bucket}/${Key}`); - const s3 = new S3.S3Client({ region }); - await s3.send(new S3.CopyObjectCommand({ - CopySource: `${md.Bucket}/${md.Key}`, - ContentType: md.MIMEType, - Bucket: Bucket, - Key: Key - })); - - return md; - } - async resize(md, filename, dims) { const tmp_path = path.join(this.tmp_dir, filename); await sharp(path.join(this.tmp_dir, md.FileName), SHARP_CONFIG) @@ -327,7 +307,6 @@ export default class Task { md.MIMEType = md.MIMEType || mimetype || 'image/jpeg'; md.SerialNumber = md.SerialNumber || 'unknown'; - md.ArchiveBucket = this.ARCHIVE_BUCKET; md.ProdBucket = this.SERVING_BUCKET; md.Hash = await this.hash(md.FileName); md.ImageBytes = await this.byte_size(`${this.tmp_dir}/${md.FileName}`);