Draft
Conversation
Release EnvironmentsThis Environment is provided by Release, learn more! 🔧Environment Status : https://app.release.com/public/Processing%20Foundation/env-58239eb320 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
This PR addresses issues with orphaned assets accumulating in the AWS s3 Bucket. Currently, one confirmed cause can be reproduced by:
Another potential cause is when project cloning is disrupted, since it appears that assets are uploaded to s3 before the project is successfully cloned.
Changes:
This PR proposes creating a
pendingfolder within the S3 bucket that will hold uploaded user assets until a user saves their project. On project save, the asset should be removed from thependingfolder and be moved to the general bucket. This PR is incomplete, and currently conflicts with other scenarios, such as when a user uploads assets to a saved project.This solution altogether is also just a suggestion, so I'm definitely open to other ideas on this as well!
aws.controller.js: Referencereq.user.idinstead ofreq.body.userId. Adds in thependingfolder when a user uploads an asset.server/utils/pendingAssets.js: Adds a util that handles committing any pending assets to the general bucket on project save, which should copy the asset and delete it from thependingfolder.server/controllers/project.controller.js: Adds thecommitPendingAssetsutil to the project controller and removes the portion checking for stale files. I felt that this wasn't successfully capturingclient/modules/IDE/actions/project.js: When a user attempts to clone a project, it will now delete any added s3 files if the project cloning fails.I have verified that this pull request:
npm run lint)npm run test)npm run typecheck)developbranch.Fixes #123