We have implemented post deletion functionality in a previous sprint. However, we need to handle the case in which attachment deletion from the storage bucket fails during post deletion. We want to add a cron job to remove all the missed deletions so that we don't incur extra cost.
Requirements
You are to write a cron job using Netlify Scheduled Functions. This cron job should be invoked once every day and should do the following:
Fetch all storage bucket objects. The object keys are in the form postId/attachmentName.fileExtension.
Fetch all posts that are pending: false.
Determine the attachments (bucket objects) that are not associated with any posts.
Delete those attachments (retry 3 times).
For testing, you can contact your engineering leadership for our storage bucket credentials to make sure your function invocation does what it is intended to do.
Acceptance Criteria
PM
[ ] Unused images should be garbage collected once a day via this ticket
EM
[ ] Log any errors using Sentry
[ ] Cron job occurs once every day
[ ] Attachments not associated with a post are deleted correctly with error retrying logic
Context
We have implemented post deletion functionality in a previous sprint. However, we need to handle the case in which attachment deletion from the storage bucket fails during post deletion. We want to add a cron job to remove all the missed deletions so that we don't incur extra cost.
Requirements
You are to write a cron job using Netlify Scheduled Functions. This cron job should be invoked once every day and should do the following:
postId/attachmentName.fileExtension
.pending: false
.For testing, you can contact your engineering leadership for our storage bucket credentials to make sure your function invocation does what it is intended to do.
Acceptance Criteria
PM
EM