Skip to content

Commit

Permalink
Stop copying images to archive bucket, #66
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielrindlaub committed Sep 9, 2023
1 parent 4d0b0ee commit ea37b1f
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions ingest-image/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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}`);
Expand Down

0 comments on commit ea37b1f

Please sign in to comment.